# Re: [ferret_users] Making a Z-plot

Hi Russ

thank you for your detailed & very helpful explanation. These allowed me to create the graph I was after.

Cheers,

L.

On Mon, Nov 18, 2013 at 12:08 PM, Russ Fiedler wrote:
Hi Luke,
You're nearly there. You just need to define a depth axis and then combine the two levels using IF/ELSE masking

def axis/z=0:10:10/depth/units="m" myz
let dummy2=dummy+z[gz=myz]   ! 2D dummy

! If level 1 we want the surface temp level 2 gets the 10m
! adding 0*dummy2 promotes to 2D

let var_2d = if k eq 1 then var2 + 0*dummy2 else var1

In fact you could create the new variable directly without the intermediates var1,var2

let var_2d  = if k eq 2 reshape(temp1, dummy) + 0*z[gz=myz] else reshape(temp2, dummy)

Cheers,
Russ

On 19/11/13 06:25, Luke M wrote:
Hi ferret users

I am trying to make a "z-plot" that looks similar to the one shown in the bottom of Ferret "Tour" page (http://ferret.pmel.noaa.gov/Ferret/documentation/levitus-tour) using some ascii data I have.

I would like to create a plot that shows "time" in the x-axis (instead of latitude), depth on the y-axis, and then plot colors & contour lines using temperature information (just like in the mentioned Ferret Tour example).

Since the ascii file I have (attached below) has the temperature information at 10 and 0m depths for a particular lat&lon point, is there a way to represent this in "z-form" as a function of time? I guess that I am a bit confused on how to tell Ferret how to interpret the data (since it is different from a regular gridded netcdf file such as COARDS).

L.

ASCII file contents:

A10 11/10/2013 18:20:34 20.16 27.19 654
A9 11/11/2013 14:30:35 21.34 27.69 564
A3 11/12/2013 12:10:37 20.47 27.39 652
A13 11/12/2013 14:20:38 20.34 26.69 653
A11 11/14/2013 18:30:39 20.12 26.8 653

The columns above represent:
line_#, date, time, temp_at_10m_depth, temp_at_0m_depth, daily_obs_#

set data/format=delimited/delim=" "/var="linenum,date,time,temp1,temp2"/type="text,date,time,num,num"/col=6 data3.asc
let tstep = date + time/24.
define axis/T/T0=1-jan-1900/UNIT=days ttaxis=tstep
let dummy = t[gt=ttaxis]
let var1 = reshape(temp1, dummy)
let var2 = reshape(temp2, dummy)