Rephrasing my question

Sestak, Dr. Michael michael.sestak at FNMOC.NAVY.MIL
Wed Mar 30 13:27:45 EST 2005


To do what you are suggesting requires a grid to be added to your grads file
that is a sea/land mask on the same grid as your temperature data.  Your
regional model probably has an output field which is a sea/land mask.  To
use this with the grads maskout function, you need to define the "land"
value in this sea/land grid to be negative (if it isn't already).  Then, if
vold is your original grid and mask is the sea/land mask

define vnew=maskout(vold,mask)

will create a variable vnew with all the values over water unchanged, and
all the values over land set to the undefined value you set in your control
file.  Currently your dataset has the same missing value (255) for gaps over
ocean and over all land.  If you set the undefined value in your control
file to something other than 255, say -999, then in vnew, the gaps over
water will still be 255, but the over land values will be -999.  Then you
need to set up your substitute land data to be the reverse, that is
undefined over water, but correct values over land.  You can combine these
two grids (one with good data over land, the other with good data over
water, by adding them together after using the const function to set all
undefined values in each to zero.  Thus, if vold is your original grid,
vclimo is your grid with good land values (say from climatology), and mask
is the sea/land mask, which has -1 for land and 1 for sea, then

define vsea=maskout(vold,mask)
define vland=maskout(vclimo,-mask)
define vsea=const(vsea,0,-u)
define vland=const(vland,0,-u)
define vnew=vland+vsea

will produce a grid with land values substituted from the vclimo grid.  Then
you can save vnew by writing it to a file using fwrite, close the old file,
and reopen vnew with a control file that has the old missing value of 255,
so you can do your interpolation to fill in the over sea gaps.

See the grads documentation index at
http://grads.iges.org/grads/gadoc/gadocindex.html for more information on
const, maskout and fwrite.  I know nothing about iterp.  To be honest, I
would use a Fortran program and an interpolation library routine if I had to
do what you are doing, not grads.

-----Original Message-----
From: Matt Georgescu [mailto:matt1 at CEP.RUTGERS.EDU]
Sent: Wednesday, March 30, 2005 9:35 AM
To: GRADSUSR at LIST.CINECA.IT
Subject: Rephrasing my question


I think I need to rephrase my question as I likely didn't describe myself
well the first time.

I have hi-res AVHRR SST data.  The problem with the data is that it has
gaps:
http://cep.rutgers.edu/~matt1/sst_07week1_95_raw.gif

The undefined values (could be any value, but it happens to take on a
value of 255) are the same over land as they are over water.  Indeed the
continental areas are just 1 really huge gap.

My goal is to fill in the gaps, everywhere (including land), so that no
points remain undefined.  I did this using a weighted average in Fortran
and while the results look decent enough over water, they are poor over
land, and the model I am using is not accepting the data:
http://cep.rutgers.edu/~matt1/sst_070195.gif

(the values over land have been masked using basemap.gs in the figure
above).

What I would like to do is to fill in these gaps (as in the sst_070195
image above) but to have more realistic values over land (which aren't
evident in the image directly above, preferably from another dataset).
The issue is how to tell GrADS to plot 1 thing over water and another
over land (keeping in mind that the initial data has the same undefined
value everywhere, whether over land or water).

Or perhaps there is some other way?

On a related issue I've found and installed the user-define function
called lterp.  I'm assuming and hoping this function may also help me. But
I cannot seem to find any documentation on its usage.
Can someone point me to such a document?

thanks for your help,
matt



More information about the gradsusr mailing list