First the easier part of your question. Once you have two datasets initialized in Ferret, you can regrid a variable from one dataset to the grid of another with a definition of a variable, including the regridding operation in the definition. If dataset 1 contains a data variable called AOD on a 1x1 grid and datasets 2 contains O3 data on a 5x5 grid, then you can define
LET AOD5 = AOD[d=1,gxy=O3[d=2]]
This says, define the new variable AOD5 which is AOD from dataset 1, regridded to the x and y grid of O3 from dataset 2.
As to reading the data, Ferret does not have any syntax to read ASCII data that's organized like yours in blocks of data, skipping the sub-headers for each latitude. One way to proceed is to use other software to reformat the files into a form that could be read using the ideas and examples in the Users Guide Chapter 2 Section 5.1, "Reading ASCII files"
Another method might be to use Ferret to read in the data and convert it to a netCDF file. This would be similar to what's in the Users Guide, if you look in the index under "append, slab to NetCDF file". The example in that section describes adding multiple Z levels to a netcdf file, but here we would be adding longitudes to the file.
Here is an outline of what you would need to do, with some example commands below.
First you would define the longitude and latitude grid corresponding to the data in the file, then read the data for one latitude at a time, using /SKIP to get to the correct record at each step. I am guessing about the axis definitions; use the correct ones for the data.
On the FILE commands, you read in the ASCII data. You will need to work out how to read all of the longitudes for a degree of latitude, so you will need to determine the values to use in /SKIP= and /COLUMNS= and perhaps a /FORMAT= . Use a LIST command to check that you're reading the data correctly.
I have not tested whether it works to start with 89.5 north and append data for 88.5, then 87.5 and so on, as I start to do below. You might need to start by skipping to the end of the file and reading the data for the southernmost latitude first, -89.5 or whatever it is, and then skip to -88.5, -87.5, always skipping fewer lines, filling in the netcdf file from south to north as you go.
yes? ! Define the grid of the entire data set
yes? DEF AXIS/x=0.5:359.5:1/units=degrees xaxis
yes? DEF AXIS/y=-89.5:89.5/units=degrees yaxis
yes? ! Define the grid for one latitude
yes? DEF GRID/X=xaxis/Y=yaxis xy_grid
yes? DEF AXIS/Y=89.5:89.5:1 yaxis1
yes? DEF GRID/LIKE=xy_grid_grid/y=yaxis1 xy_grid1
yes? ! read in the first longitude
yes? FILE/GRID=xy_grid1/VAR="a"/skip=/format=/columns aod_file.dat
yes? ! Put it onto the whole grid and write to the file.
yes? ! Here is where you can set the missing data flag for the variable
yes? LET/TITLE="AOD"/BAD=-999 AOD = a[G=xy_grid]
yes? SAVE/FILE=aod.cdf/JLIMITS=1:180/J=180 aod
yes? CANCEL DATA aod_file.dat
yes? DEF AXIS/y=88.5:88.5:1 yaxis1
yes? FILE/GRID=xy_grid1/VAR="aod"/skip=/format=/columns aod_file.dat
yes? SAVE/FILE=aod.cdf/APPEND/J=179 aod
yes? CANCEL DATA aod_file.dat
yes? DEF AXIS/y=87.5:87.5:1 yaxis1
. . .
! The above sequence could be put into a REPEAT loop, once you have
! worked out how to read each latitude.
! Cancel definitions before using new file
yes? CANCEL DATA/ALL
yes? USE aod.cdf
Yogesh Tiwari wrote:
-- ~> ~> ~> ~> ~> ~> ~> ~> ~> ~> ~> Ansley Manke, NOAA/PMEL ansley.b.manke@xxxxxxxx 7600 Sand Point Way NE, Seattle WA Phone 206-526-6246, FAX 206-526-6744