defining new array - repost

Arindam Chakraborty arch at IO.MET.FSU.EDU
Wed Apr 27 12:47:16 EDT 2005


hi Mariusz,
        the trick is to introduce an additional dimension to the
hourly rainfall data. And the assumption is that the variable
has a free dimension (may be level in this case) and you have only
one variable in this file (this later assumption may not be required if
some other tricks are applied). Well, assuming these you may
try applying the followings:

View your time series as two dimensional. The z-dimension is hrs
and t-dimension is days. Means, if you have 100 days (2400 time
points in total), you need to write the control file as
....
zdef 24 linear 1 1
tdef 100 linear 1jan1998 1dy
vars 1
var 24 99 rainfall
endvars

This is the control file which points to the actual time series of
your data. The next trick is to write another control file which will
point to the same data file but with a shifted time coordinate. This
is to make the subtraction sitting at the same time coordinate. This
2nd control file will read
....
zdef 24 linear 1 1
tdef 100 linear 31dec1997 1dy * starts 1 day early
vars 1
var 24 99 rainfall
endvars

Notice the shift here. The actual rainfall of 1jan98 will be viewed by
the 2nd file as for 31dec97. And actual rainfall of 2jan98 will be
viewed as for 1jan98, and so on. Now we can make the subtraction.

'open 1st_file.ctl' * 'actual'
'open 2nd_file.ctl' * dummy
'set horizontal dimensions'
'set t 1 99'
'set z 1' * z = 1 is the 1st hour
'd var.2 - var'


Hope this works out.
----------------------------
 ARINDAM CHAKRABORTY
 Department of Meteorology
 Florida State University
 Tallahassee, FL-32306, USA
 Tel: +001-850-6443524 (Off)
      +001-850-5758550 (Res)
 Fax: +001-850-6449642
____________________________

On Wed, 27 Apr 2005, Mariusz Pagowski wrote:

> Hello,
> Sorry for the respost - I forgot to name the subject in the
> header of my previous mail.
>
> In Grads I read a file with model hourly accumulated precipitation
> and store data in "hourly"   array.
> I want to convert hourly accumulated to daily totals. and later process
> it further. In fortran it would  look like that:
>
> real daily  :: (nx,ny,30)
> real hourly :: (nx,ny,721)
>
> daily(1)=hourly(25)-hourly(1)
> ....
> daily(30)=hourly(721)-hourly(697)
>
> After different tries with a define I ran out of ideas
> how to declare a daily array and assign daily precip as above
> in the fortran code.
>
> I would very much appreciate help.
> Thanks,
> Mariusz
>
> ___
>
> Mariusz Pagowski
> NOAA Research-Forecast Systems Laboratory*,
> 325 Broadway FSL/FS1, Boulder, CO 80305-3328
> Tel: (303)497-6443, Fax: (303)497-7262
> e-mail: Mariusz.Pagowski at noaa.gov
>
> *In collaboration with
> Cooperative Institute for Research in the Atmosphere (CIRA),
> Colorado State University
> __________________________________________________________________
>



More information about the gradsusr mailing list