[Thread Prev][Thread Next][Index]

Re: [ferret_users] how to define time axis in plotting temp from an ascii file?



Hi,

You want to define a 2-D grid, depth and time. When reading an ascii file,
http://ferret.pmel.noaa.gov/Ferret/documentation/users-guide/data-set-basics/ASCII-DATA

this is similar to the Example 4 in that section, a variable in 2 dimensions, except that there is also the TIME listed in each record.

If there were just temp1, temp5, temp9, then you would define a grid and read in the data, something like this. 
define axis/t... taxis
define axis/z... zaxis

define grid/z=zaxis/t=taxis ztgrid
file/columns=3/var=temp/grid=ztgrid my_data.dat
but that won't work because the first column is time.  One thing that occurs to me is to do this in two steps. First read the time data,  and define the time axis. Then define a z axis with a fake point somewhere before the first depth, and read all four columns onto this, and then do not use the first "depth" because it came from column 1. So that might look like this. (Obviously I'm just typing commands here, I haven't tested this, so it's just an example.)
! First read the times and define the time axis.

file/var=time  my_data.dat
define axis/t/units=days/t0=1-jan-2010 day_axis = time

! Close the file and start over. The time axis is still defined.
! Define the z-t grid and read all the data

cancel data/all

define axis/z/depth/units=meters zax = {0,1,5,9}
define grid/z=zax/t=day_axis ztgrid

file/var=temp/columns=4/grid=ztgrid test.dat

Now, you've got temp, but the times are sitting in the first grid-cell in the Z direction.  Make a plot, excluding the grid point at z=0.
shade temp[z=1:9]
You could write the data out, skipping the fake z=0, and from then on use that.  You'd want to give TEMP some attributes with SET VAR/TITLE=" "/UNITS=" " temp, first.
save/file=temp_data.nc temp[k=2:4]



On 11/4/2016 11:21 AM, 'Sara Sari' via _OAR PMEL Ferret Users wrote:
Oh. never  mind.I found the script for it.
now could you please tell me how I can set my y axis to be depth. so that I can plot temp on depth and time axes... (yaxis =depth and xais=time)
I don't have any specific column for depth... I just have columns for temp of different depths...as I explained in my previous email.
Thank you,
Sara


On Friday, November 4, 2016 12:56 PM, 'Sara Sari' via _OAR PMEL Ferret Users <ferret_users@xxxxxxxx> wrote:


Hello,
I have an ascii file that has 4columns in this order:
column 1: day number from 127 to 273(every 10min)
column 2: temperature of depth 1m
column 3: temperature of depth 5m
column 4: temperature of depth 9m
and has 21032 rows...
if I want to plot temp 1, I type this:

file/format=delim/skip=1/var="time,temp1,temp5,temp9"  west.csv
plot temp1
and it produces a plot of temp vs row numbers (attached file)...how can I define my time axis so that my plot is the temperature vs time(day).
I tried to use
define axis/t=127:273/npoint=21032/ units=days  day_axis
yes? let temp_on_time=temp1[gt=day_axis@asn]
plot temp_on_time
but seems I can't use this script here (probably because my file is ascii?).

this is my first question. and I'll ask my second one after I fix this part.
Thank you,
Sara




[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce / NOAA / OAR / PMEL / Ferret

Privacy Policy | Disclaimer | Accessibility Statement