[Thread Prev][Thread Next][Index]
Re: determine T0 from Netcdf header
Hi Steve Knox,
In Ferret, you can derive lot of informations about the
variable in a NetCDF file. Please have a look at the user manual for
the key word "RETURN". Here is an example :
! please note that "RETURN" is used within grave accents (``)
yes? set data monthly_navy_winds ! dataset available with Ferret
yes? define symbol t_zero = `uwnd,r=T0` ! r ==> RETURN
yes? define symbol t_units = `uwnd,r=TUNITS`
yes? define symbol t_cal = `uwnd,r=CALENDAR`
yes? show symbol t_zero, t_units, t_cal
T_ZERO = "14-JAN-1980 14:00:00"
T_UNITS = "hour"
T_CAL = "GREGORIAN"
So "define symbol" command along with "RETURN" will help us to get
the neccessary informations in seperate variables. Please note that
it will be safe to put the ($t_zero) in double quotes(" ") wherever it is
used beacause it may contain the hr:min:sec along with the date,
seperated by a blank space. To define a new time axis from these
informations
yes? define axis/t=10-JAN-2000:10-DEC-2000:1/units=($t_units)/\
...? t0="($t_zero)"/CALENDAR=($t_cal) tax
Suppose you want to get "T0" without the hr:min:sec string. Then use
"SUBSTRING" command to extract only the date as follows :
yes? define symbol t_z = `SUBSTRING("($t_zero)",1,11)` ! in grave accents
yes? show symbol t_z
T_Z = "14-JAN-1980"
yes? plot i[i=1:10]
yes? label 4,5,0,0,0.12 ($t_z)
Hope This Helps
With Regards
Jaison
On Mon, 3 Jan 2005, Steve Knox wrote:
> Good day,
>
> I'm trying to read Netcdf files with ferret.
> Is there a way for Ferret to return, _as a variable_, the value of the
> time _origin _of a netcdf file?
>
> The Netcdf files use the COARDS conventions:
> int time(time) ;
> time:long_name = "Time" ;
> time:units = "days since 1895-01-01" ;
> time:time_step = "monthly" ;
> but in general the time units will vary so I don't know before running
> my Ferret script what the time
> origin is, unless I write a separate script to parse the header info and
> the value of time(0) from the
> Netcdf file. I'd like to avoid having to do that and just let Ferret
> return "T0".
>
> Thanks!
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> int time(time) ;
> time:long_name = "Time" ;
> time:units = "days since 1895-01-01" ;
> time:time_step = "monthly" ;
>
>
--
___________________________________________________
Jaison Kurian
Centre for Atmospheric and Oceanic Sciences
Indian Institute of Science
B A N G A L O R E 560 012
Ph: +91-80-3942505
+91-80-3600450
Fax:+91-80-3600865
___________________________________________________
[Thread Prev][Thread Next][Index]
Dept of Commerce /
NOAA /
OAR /
PMEL /
TMAP
Contact Us | Privacy Policy | Disclaimer | Accessibility Statement