[Thread Prev][Thread Next][Index]

Re: [ferret_users] error in y coordinate of an ascii file



Hi Otacilio,
When I try to read the file that's attached to your email I get a read error, so perhaps the file didn't come through correctly. I'm unable to see much about the file listing it from the unix command line - it seems to be lots of zero's. 

The FILE command in Ferret is an alias for the  "SET DATA" command. It doesn't read data, it just locates the datset and sets up grids and variables according to what is in the command. SHOW DATA then lists out what that initialization step has done. After your first SHOW DATA, try a SHADE CO2 command to see if the data looks correct.

Does the dataset contain 360*180 = 64800 records, each with a single value?  If so then the commands will read the data correctly.  If the file is organized some other way, then look up "ASCII data, reading, examples" in the index to the Ferret users guide, and read through the examples to find the form you need to use.

Now, these commands at the start of your script
define axis/x=1:360:1 long_grid
define axis/y=1:180:1 lat_grid
define grid/x=long_grid/y=lat_grid newgrid

file/var="co2"/format=unformatted/grid=newgrid "CO2/CO2_199701.txt"
already put the data onto the grid defined by lat_grid, lon_grid, so the "let gridded_co2" command in the example you were looking is redundant.

Ansley

On 10/16/2011 12:49 PM, Otacilio Leandro wrote:
Dear Ferrets,

I was folowing the same procedure of this link:

http://www.pmel.noaa.gov/maillists/tmap/ferret_users/fu_2009/msg00376.html

to open an ascii and save to cdf, but i don't know what happens that
the y coordinate "vanish". I checked it and before save to cdf file it
was 1:180 and after it was 1:1.

The file is attached and the following lines shows whats is going on...

Thanks!

****************************************************

! Each data file contains 360 columns and 180 rows (and has a 1 degree
latitude by 1 degree longitude spatial resolution, with a monthly
temporal resolution). The upper left corner of each file is at 180.0W,
90.0N, and the lower right corner is at 180.0E, 90.0S.


define axis/x=1:360:1 long_grid
define axis/y=1:180:1 lat_grid
define grid/x=long_grid/y=lat_grid newgrid

file/var="co2"/format=unformatted/grid=newgrid "CO2/CO2_199701.txt"
sh d
     currently SET data sets:
    1> CO2/CO2_199701.txt  (default)
 name     title                             I         J         K         L
 CO2      CO2                              1:360     1:180     ...       ...

let gridded_co2=co2[gx=long_grid,gy=lat_grid]
sh g gridded_co2
    GRID NEWGRID
 name       axis              # pts   start                end
 LONG_GRID X                  360 r   1                    360
 LAT_GRID  Y                  180 r   1                    180
 normal    Z
 normal    T
save/clobber/file=output.cdf gridded_co2
 LISTing to file output.cdf

use output.cdf
sh d
     currently SET data sets:
    1> CO2/CO2_199701.txt
 name     title                             I         J         K         L
 CO2      CO2                              1:360     1:1       ...       ...

    2> ./output.cdf  (default)
 name     title                             I         J         K         L
 GRIDDED_CO2
          CO2[GX=LONG_GRID,GY=LAT_GRID]    1:360     1:1       ...       ...


exit



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

Privacy Policy | Disclaimer | Accessibility Statement