[Thread Prev][Thread Next][Index]

Re: [ferret_users] time axis and precision



Hi-
Yes, you're right - the single-precision variable tstep doesn't have enough precision to represent seconds when the time origin is 1900. There is an easy answer, which is to move the time origin.  The DAYS1900 function is what you need.

So for instance to move the time origin to 1-jan-2000, here's the small change to your script, and the result of running it.
 

yes? ! Read file
yes? File /Var="TEMP,julday,hhmmss" /Form=Delim /Delim="\b" /Type="NU,EURODATE,TI" tyty.dat

yes? ! Define a time axis from variables julday and hhmmss
yes? Let day_frac  = hhmmss/24
yes? Let tstep     = julday - days1900(2000,1,1) + day_frac
yes? define axis/t/t0=01-jan-2000/unit=days t_axis_02 = tstep

yes? ! List the times, down to seconds
yes? set mode calendar:seconds

yes? let temp_t = tsequence(temp[L=1:4])
yes? list temp_t[GT=t_axis_02@asn]
             VARIABLE : TSEQUENCE(TEMP[L=1:4])
                        regrid: on T@ASN
             FILENAME : tyty.dat
             SUBSET   : 5 points (TIME)
 10-AUG-2009 05:23:05 / 1:  16.43
 10-AUG-2009 05:24:08 / 2:  16.51
 10-AUG-2009 05:24:50 / 3:  16.50
 10-AUG-2009 05:25:53 / 4:  16.39
 10-AUG-2009 05:26:57 / 5:  16.37




On 6/15/2011 1:13 AM, Bruno Levier wrote:
Hi Ferreters

I'm trying to read an ascii file (tyty.dat) containing temperature and time, and to define a time axis from the variable read.

tyty.dat :

 16.4306   10/08/2009 05:22:59
 16.5106   10/08/2009 05:23:59
 16.4976   10/08/2009 05:24:59
 16.3889   10/08/2009 05:25:59
 16.3681   10/08/2009 05:26:59
...

! Read file
File /Var="TEMP,julday,hhmmss" /Form=Delim /Delim="\b" /Type="NU,EURODATE,TI" tyty.dat

! Define a time axis from variables julday and hhmmss
Let day_frac  = hhmmss/24
Let tstep     = julday + day_frac
Define Axis /T /T0=01-JAN-1900 /Unit=days t_axis_02 = tstep

 *** NOTE: Axis has repeated values -- micro-adjusting ...

List TEMP[GT=t_axis_02@ASN]

 10-AUG-2009 05:20:39 / 1:  16.43
 10-AUG-2009 05:26:15 / 2:  16.51
 10-AUG-2009 05:26:15 / 3:  16.50
 10-AUG-2009 05:26:15 / 4:  16.39
 10-AUG-2009 05:26:16 / 5:  16.37
...

The problem is that the precision is not enough to calculate the julian day properly.

Is there a trick to do this right ?

Thank you for your suggestions.

Bruno Levier




       Bruno LEVIER
       /MERCATOR Ocean/
       Parc Technologique du Canal
       8-10 rue Hermes
       31520 Ramonville Saint Agne
       FRANCE
       Tel: +33 5 61 39 38 51
       Fax: +33 5 61 39 38 99
       http://www.mercator-ocean.fr





_____________________________________________________________________

Découvrez le nouveau site web de Mercator Océan : www.mercator-ocean.fr
Welcome on the new Mercator Ocean website: www.mercator-ocean.fr


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

Privacy Policy | Disclaimer | Accessibility Statement