[Thread Prev][Thread Next][Index]

Re: time/date format for netcdf



Hi Enils,
The command FILE/FORMAT=DELIMITED will read and translate
date and time fields.   See "delimited files, reading" and "SET DATA/
FORMAT=DELIMITED" in the Users Guide index. You should keep
the date and time as two separate fields in your file  2003-09-23  09:00:00

Here I made up some data and show how to read it. dateval.dat
has these three columns: date, hour, and a data value

2003-09-23 09:00:00 1.5
2003-09-23 10:00:00 6.0
2003-09-23 11:00:00 9.4
2003-09-23 12:00:00 4.4
2003-09-23 13:00:00 5.0

! Read this into Ferret as follows:
yes? file/form=delim/var="dy,hr,val"/type="date,time,num"/delim=" " dateval.dat
yes? list dy, hr, val   ! Notice the units for dy are "days since 1-jan-1900"

             DATA SET: ./dateval.dat
             X: 0.5 to 5.5
 Column  1: DY is DY (days)(Julian days since 1-Jan-1900)
 Column  2: HR is HR (hours)(Time of day)
 Column  3: VAL
             DY     HR    VAL
1   / 1:  37885.   9.00  1.500
2   / 2:  37885.  10.00  6.000
3   / 3:  37885.  11.00  9.400
4   / 4:  37885.  12.00  4.400
5   / 5:  37885.  13.00  5.000
 
! Now we can use the day and time variables to create a time
! axis for the variable val

yes? let tpts = dy + hr/24
yes? define axis/t/units=days/t0=1-jan-1900 tax = tpts
 
yes? let valt = reshape(val,t[gt=tax])
yes? plot valt
 

Enils, we'll work out how to read all your datafiles and get
them into a data set outside the Users List and post the answer
back here when we have it.

Ansley Manke

Enils Bashi wrote:

Dear Ferreters,

I think probably some of you have been through this problem before.
I have carefully read the ferret user documentation and some previous online
postings to ferret forums, but I still have hard time with the time/date
when creating netcdf files.
My date/time format from my ascii files that I generated from MySql
Databases is as follows:
yyyy-mm-dd hh:mm:ss or for example
2003-09-23   09:00:00
This format did not work when trying to generate netcdf files. I used mysql
date format functions to make it so ferret "likes" it (dd-mmm-yyyy:hh:mm),
but no luck. Here is the example:

yes? def axis/x=80w:72w:1/units=longitude xax
yes? def axis/y=36n:40n:1/units=latitude yax
yes? def axis/z=0:0:1/units=meters zax
yes? def axis/t="1-jan-2003:00:00":"31-aug-2003:00:00":1/units=days tax
yes? def grid/x=xax/y=yax/z=zax/t=tax bishopville
yes?
file/grid=bishopville/var="time,lat,lon,temp,salinity,dop,doc,ph,turbidity,c
hlorophyll" bishopville.res
yes? save/file=bishopville.cdf
time,lat,lon,temp,salinity,dop,doc,ph,turbidity,chlorophyll
Success
 **TMAP ERR:
             Last or next-to-last record read:
"26-apr-03:06:04" 38.42 -75.19 15.46 17.25 95.30 8.57 13
             Data set: ./bishopville.res
             Data file: ./bishopville.res

Any and all feedback would be greatly appreciated.

Enils Bashi
Programmer - Chesapeake Bay Program
Veridyne Incorporated
Annapolis, Maryland: (410) 267-9833
www.chesapeakebay.net

--
Ansley Manke  Pacific Marine Environmental Laboratory  Seattle WA
 


[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement