[Thread Prev][Thread Next][Index]

Re: [ferret_users] Problem in listing dates into ascii format



Hi,
It looks as though the double precision version of Ferret has a bug in some of the TAX_* functions.

When Ferret variables were single precision, prior to Ferret v6.8, the functions such as

TAX_DAY(A,B)
    Returns days of month of time axis coordinate values
    A: time steps to convert
    B: variable with reference time axis

had an essential problem.  The first argument, giving the time step to convert, was a single-precision variable, as were all Ferret variables.  Sending in t[gt=var] as you did, was the best we could do, but doing that meant a conversion to single precision. The axis itself is and always has been stored and values used internally as double precision values, so the second argument tells the function to go get those double precision coordinates.  The function took the values sent in, in argument 1, and tried to match them with a double precision value on the time axis.

Now, with Ferret v6.8 and higher, everything having  to do with this function is double precision.  For this particular axis, the coordinate values need double precision to be accurate.  Unfortunately when converted Ferret to double precision, we left in the code that was trying to match single-precision values from argument 1 with double-precision time coordinates, and that's getting the wrong time step for some of the steps on this particular time axis.

This will be fixed in the next Ferret release.

(By the way, the variables salt and temp do not have x and y axes in the file that you sent.  So, lat[gx=temp],lon[gy=temp] could be replaced simply by lat,lon  in the LIST command. )


On 2/26/2013 10:57 PM, neethu chacko wrote:
Hi,

 I have to get an ascii file in the following format.

DD  MM  YY  Variable 1   Variable 2   Variable 3 ......


The script i used is :
define symbol fname=R2900765
set da "../data/argo/($fname).nc"

set var/bad=-999 temp
set var/bad=-999 salt

sp rm argo1.dat
repeat/l=1:20:1 (list/file=argo1.dat/clobber/nohead/append/format=("`TAX_DAY(T[gt=TEMP],TEMP)`",2x,"`TAX_MONTH(T[gt=TEMP],TEMP)`",2x,"`TAX_YEAR(T[gt=TEMP],TEMP)`",4f10.3) lat[gx=temp],lon[gy=temp],TEMP[k=1],salt[k=1])

The output  am getting is :
28  9  2006    15.031    89.101    28.711    33.780
3  10  2006    15.015    89.202    28.774    33.532
8  10  2006    14.904    89.250    28.715    33.353
18  10  2006    14.886    89.197    29.190    33.406
23  10  2006    14.724    89.189  -999.000  -999.000
23  10  2006    14.584    89.113    29.402    33.298
28  10  2006    14.488    89.050    29.118    32.844
7  11  2006    14.470    89.070    29.251    32.944
7  11  2006    14.578    89.036    29.150    32.823
17  11  2006    14.662    89.043    29.036    33.236
17  11  2006    14.482    89.093    28.830    33.104
22  11  2006    14.297    89.051    28.910    33.310
2  12  2006    14.160    89.057    28.744    33.398
2  12  2006    14.038    89.020    28.420    33.426
7  12  2006    13.949    88.991    28.088    33.314
17  12  2006    14.013    88.912    28.086    33.447
17  12  2006    14.110    88.800    27.853    33.453
22  12  2006    14.236    88.597    27.662    33.483
27  12  2006    14.337    88.399    27.512    33.570
1  1  2007    14.441    88.174    27.508    32.791
....................................................................................

But the dates are wrong as my data is having 5 days resolution.The actual dates are:


yes? sh grid/t temp
    GRID GAB2
 name       axis              # pts   start                end
 normal    X
 normal    Y
 ZPRES     DEPTH (DECIBARS)   120 i-  5                    2000
 TIME      TIME                89 i   28-SEP-2006 22:27    17-DEC-2007 21:47
 normal    E
 normal    F
 
       L     T                   TBOX      TBOXLO                TSTEP (DAYS)
       1>  28-SEP-2006 22:27:11  4.986328   26-SEP-2006 10:37:01    20724.94
       2>  03-OCT-2006 22:07:30  5.007813   01-OCT-2006 10:17:20    20729.92
       3>  08-OCT-2006 22:49:41  5.021484   06-OCT-2006 10:28:35    20734.95
       4>  13-OCT-2006 23:09:22  4.994141   11-OCT-2006 10:59:31    20739.96
       5>  18-OCT-2006 22:32:48  4.966797   16-OCT-2006 10:51:05    20744.94
       6>  23-OCT-2006 21:33:45  4.993164   21-OCT-2006 10:03:16    20749.9
       7>  28-OCT-2006 22:13:07  5.029297   26-OCT-2006 09:53:26    20754.93
       8>  02-NOV-2006 22:58:07  4.996094   31-OCT-2006 10:35:37    20759.96
       9>  07-NOV-2006 22:01:52  4.992188   05-NOV-2006 10:30:00    20764.92
      10>  12-NOV-2006 22:35:37  5.003906   10-NOV-2006 10:18:45    20769.94
      11>  17-NOV-2006 22:13:07  4.994141   15-NOV-2006 10:24:22    20774.93
      12>  22-NOV-2006 22:18:45  5.018555   20-NOV-2006 10:15:56    20779.93
      13>  27-NOV-2006 23:06:33  4.998047   25-NOV-2006 10:42:39    20784.96
      14>  02-DEC-2006 22:13:07  4.995117   30-NOV-2006 10:39:50    20789.93
      15>  07-DEC-2006 22:52:30  5.009766   05-DEC-2006 10:32:48    20794.95
      16>  12-DEC-2006 22:41:15  4.973633   10-DEC-2006 10:46:52    20799.95
      17>  17-DEC-2006 21:36:33  4.979492   15-DEC-2006 10:08:54    20804.9
      18>  22-DEC-2006 21:42:11  5.015625   20-DEC-2006 09:39:22    20809.9
      19>  27-DEC-2006 22:21:33  5.02832    25-DEC-2006 10:01:52    20814.93
      20>  01-JAN-2007 23:03:45  5.008789   30-DEC-2006 10:42:39    20819.96
      21>  06-JAN-2007 22:46:52  4.994141   04-JAN-2007 10:55:18    20824.95
    

 Please help me solve the problem.
Or is there any other way to get the correct date in DD MM YY  variable1 varable2 etc.format? I need to get the temp, salt variables in 3 decimal points too.


Thank you..
Neethu Chacko





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

Privacy Policy | Disclaimer | Accessibility Statement