Land Sea variable

sajjad saeed sajjad_met at HOTMAIL.COM
Sun May 13 10:13:19 EDT 2007


Dear all

I am interested to mask the sea values from the output results of model. I
am using the LAMCON map projection in my model simulations. One of my friend
suggested to use a CRU data file to solve the problem as

Open a CRU file in grads
define pmask=const(pre,0,-a)
define pmask=maskout(pmask,pmask-1)

than open the model out put file in grads and

d var*pmask

I did this but there is a dimension error. This dimension error is because
the CRU is on regular longititude and Latitude grid where as model is using
LAMCON projection.

My question is how I can create a land sea mask variable using the model
output file or if you can help me how to solve this problem

Many thanks in advance

sajjad




>From: Douglas Clark <dbcl at CEH.AC.UK>
>Reply-To: GRADSUSR at LIST.CINECA.IT
>To: GRADSUSR at LIST.CINECA.IT
>Subject: Re: how to do averaging over land
>Date: Thu, 10 May 2007 10:42:29 +0100
>
>There is a 'direct' way to do this within GrADS:
>
>1. Create a land/sea mask variable (1 at land,0 sea)
>If you don't already have this, you could create a new GrADS file, using
>the same grid as in your existing file.
>
>2. Use aave and maskout to calculate area average at land points.
>e.g.
>set x 1
>set y 1
>set t 1 12
>define a1=aave(maskout(val1,land-0.5),lon=0,lon=90,lat=0,lat=30)
>will calculate the area average of the variable val1 at land points and
>store it in variable a1.
>maskout is used here to remove sea points (where land-0.5 is <0)
>This can be done with the time dimension varying, so you get a time series
>as the result.
>
>Doug
>
> >>> stegert at IFM.UNI-HAMBURG.DE 10/05/2007 10:03 >>>
>Dear,
>
>I don't know whether there is a 'direct' way within GrADS.
>Anyway, I calculated average values at certain ocean areas.
>
>I assume you have a certain grid of say 180x120 cells (i.e.
>1'x1' per cell for your area).
>
>1) You create a land-sea-mask within an ASCII-file
>(landsea.dat) containing a 180x120 matrix of zeros and ones
>representing land and sea, respectively.
>
>2) open your grads-file and do a loop through the map (assumably
>a 2d dataset!?)
>var = 0
>inc = 0
>j   = 120
>while (j>0)
>   'set y 'j
>   lsmask = read(landsea.dat)  * opens the dat-file
>   lsline = sublin(lsmask,2)   * read line
>   i = 1
>   while (i<181)
>     'set x 'i
>     lsval = subwrd(lsline,i)  * read value
>     if (lsval = 1)            * only when on land
>       'd parameter'           * read value from grads
>       var = var + subwrd(result,4)
>       inc = inc + 1
>     endif
>     i = i+1
>   endwhile
>   j = j-1
>endwhile
>st = close(landsea.dat)
>
>With 'var' you have the total amount over land.
>With 'var/inc' you'll get the average over land.
>Mind: In the .dat the 10°N/100°E is in the last
>line (that's why to count j from 120 to 0).
>
>You can also put this within a temporal loop to
>read different time steps as well as you can define
>different areas (defined by 0,1,2,...) and with
>elseif (lsval = 2) var2 = var2+subwrd(result,4); inc2 = inc2+1; endif
>elseif (lsval = 3) var3 = var3+subwrd(result,4); inc3 = inc3+1; endif
>etc.
>
>Hope, this helps.
>Christoph
>
>praise praise wrote:
> >
> > Dear frineds,
> >
> > My problem is to construct a time series representing an area average of
> > a parameter, say temperature, over the area say (100-130E, 10-30N).  But
> > I am only interested in the average over land.
> >
> > Thus, do anyone know how to define the variable representing an areal
> > average over land only?
> >
> > Thanks
> >
> > MC
>
>
>--
>Christoph Stegert
>Institute for Oceanography - Ecological Modelling group
>University of Hamburg, GER - (ZMK/ZMAW alliance member)
>Bundesstr.53 20146 Hamburg - +49-40/42838-7486 Room 348
>
>
>--
>This message (and any attachments) is for the recipient only. NERC
>is subject to the Freedom of Information Act 2000 and the contents
>of this email and any reply you make may be disclosed by NERC unless
>it is exempt from release under the Act. Any material supplied to
>NERC may be stored in an electronic records management system.

_________________________________________________________________
Don't just search. Find. Check out the new MSN Search!
http://search.msn.com/



More information about the gradsusr mailing list