[Thread Prev][Thread Next][Index]

Re: [ferret_users] ascii grid format with header, read into ferret, convert to netCDF



Hi Matthew,
I haven't tried your commands, but what you've done look fine, except that you'll need a

     /SKIP=6

on the FILE command to skip over the header lines.

To assign a date to the data coming in from each of these files, you need the concept called "timestamping". Essentially you define a time axis, and then add 0*time to the variable at that time step, to give it a time. This is described here,

http://ferret.pmel.noaa.gov/Ferret/documentation/users-guide/commands-reference/SAVE#timestamp

-Ansley

On 5/3/2013 3:25 PM, Matthew Cooper wrote:
Hi all,

I am working with ascii grid format data, meaning the first 6 rows of the file is header info, then the grid of data represents the model output at each grid cell (example attached):

 ncols                  347
 nrows                 979
 xllcorner       588970.54128361004
 yllcorner       4864497.1359059000
 cellsize        100.00000
 NODATA_value   -9999.0000

0.79   0.79   0.79   0.81   0.81   0.82 ....1,ncols
0.79   0.79   0.79   0.81   0.81   0.82   ....
0.79   0.79   0.79   0.81   0.81   0.82   ....
0.79   0.79   0.79   0.81   0.81   0.82   ....
.
.
.
nrows,1

So, each value (0.79 for example) represents the precipitation at that 100x100 m grid cell.

I have gone over the ferret documentation 2.5: Ascii data and there doesn't seem to be information about reading data in this format. For example I have tried:

yes? define axis/x=1:347:1 longax
yes? define axis/y=1:979:1 latax
yes? define grid/x=longax/y=latax gridd
yes? file/var=ppt/grid=gridd ppt_test.asc
yes? sh data
     currently SET data sets:
    1> ./ppt_test.asc  (default)
name title I J K L M N PPT PPT 1:347 1:2 ... ... ... ...


This isn't right.

I have one of these files for each timestep of the model run. I'd like to read these files into ferret, then stack all of the files into a netcdf file so I can arrange model runs by year, where each netcdf file contains 365 ascii files representing each day of the model run.

Does ferret have the ability to read and store the header info? Would it be better if I changed the write command in my code to leave out the header info so it just gives a grid of output?

Thank you in advance! To be clear, my primary question is how to properly read in the data in the format I described (example file attached). If possible, help on converting the batch of files into a netcdf would also be great.

Matt
--
Matt Cooper
M.S. candidate, Water Resources Science
College of Earth, Ocean and Atmospheric Sciences
Oregon State University




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

Privacy Policy | Disclaimer | Accessibility Statement