[Thread Prev][Thread Next][Index]

[ferret_users] CRU ascii file to netcdf



Dear Ferret Users,

Its me, again...
I have data set of CRU 10" in ASCII format like this:
   4   1
 -999 -999 -999 -999 -999 -999 -999 -999 -999 -999 -999 -999
 -999 -999 -999 -999 -999 -999 -999 -999 -999 -999 -999 -999
 -999 -999 -999 -999 -999 -999 -999 -999 -999 -999 -999 -999
 -999 -999 -999 -999 -999 -999 -999 -999 -999 -999 -999 -999
 -999 -999 -999 -999 -999 -999 -999 -999 -999 -999 -999 -999
 -999 -999 -999 -999 -999 -999 -999 -999 -999 -999 -999 -999
 -999 -999 -999 -999 -999 -999 -999 -999 -999 -999 -999 -999
 -999 -999 -999 -999 -999 -999 -999 -999 -999 -999 -999 -999
 -999 -999 -999 -999 -999 -999 -999 -999 -999 -999 -999 -999
 -999 -999 -999 -999 -999 -999 -999 -999 -999 -999 -999 -999
   4   2
 -999 -999 -999 -999 -999 -999 -999 -999 -999 -999 -999 -999
 -999 -999 -999 -999 -999 -999 -999 -999 -999 -999 -999 -999
 -999 -999 -999 -999 -999 -999 -999 -999 -999 -999 -999 -999
 -999 -999 -999 -999 -999 -999 -999 -999 -999 -999 -999 -999
 -999 -999 -999 -999 -999 -999 -999 -999 -999 -999 -999 -999
 -999 -999 -999 -999 -999 -999 -999 -999 -999 -999 -999 -999
 -999 -999 -999 -999 -999 -999 -999 -999 -999 -999 -999 -999
 -999 -999 -999 -999 -999 -999 -999 -999 -999 -999 -999 -999
 -999 -999 -999 -999 -999 -999 -999 -999 -999 -999 -999 -999
 -999 -999 -999 -999 -999 -999 -999 -999 -999 -999 -999 -999
The 1st, 12th, 23th... lines are the coordinate numbers of the data (the longitude goes from 4:258, the latitude goes from 1:228)
The "real" first row means a year 1961... The last one 1970. The columns mean months of the year. So 10*12 matrix i have after the grid defining numbers.
I would like to make a netcdf of it. Here is how i was trying to solve this problem.

--------------------------
define axis/t=1:120:1/np=120 time
define grid/t=time grid
repeat/range=1:58140:1/name=m (file/ez/var="lon,lat"/skip=`2+11*(m-1)`:`11+11*(m-1)` "myfile" ;\
file/var=pre/skip=`1+11*(m-1)`/columns=12/grid=grid "myfile" ;\
save/file="output.nc"/append/clobber/ilimits=1:258/jlimits=1:228/i=`lon`/j=`lat` pre)
----------------------------

Has anyone faced this problem?
Thank You,
Peter Szabo, HMS

[Thread Prev][Thread Next][Index]

Contact Us
Dept of Commerce / NOAA / OAR / PMEL / TMAP

Privacy Policy | Disclaimer | Accessibility Statement