Re: How to read accumulated precip from gribs?

From: David Brown <dbrown_at_nyahnyahspammersnyahnyah>
Date: Tue, 29 Jan 2008 13:04:13 -0700

Hi Erik,

Unfortunately in the current version of NCL the only thing you can do
for this type of
variable is perform some manual intervention.
Here is a script fragment that puts all the "NCPCP_GDS0_HTGL_acc"
values into a single local
variable for the sample files you sent us.

-----------------------------------------
files = systemfunc("ls gribfile_d1.2008011618.f0?.MORE.latlon")
print(files)
files = files + ".grb"
f = addfiles(files,"r")

sizes = filevardimsizes(f[0],"NCPCP_GDS0_HTGL_acc")
print(sizes)
type = typeof(f[0]->NCPCP_GDS0_HTGL_acc)
NCPCP_GDS0_HTGL_acc = new((/3,sizes(0),sizes(1)/),type)

; this assumes sizes has 2 elements
do i = 0,2
     name = "NCPCP_GDS0_HTGL_acc"
     if (i .gt. 0) then
         name = name + i + "h"
     end if
     NCPCP_GDS0_HTGL_acc(i,:,:) = f[i]->$name$
     print( max(NCPCP_GDS0_HTGL_acc(i,:,:)))
end do

printVarSummary (NCPCP_GDS0_HTGL_acc)

------------------------------

The time and units designations were added to "statistical" variables
like this because in certain types
of files there are records that really do not belong together and had
to be distinguished as separate variables based on
the time period. Also centers often write accumulations as the amount
accumulated between the previous forecast time step
and the current one -- in which case this system works.

We hope soon to add a new GRIB file option that will allow a user to
choose to eliminate the time period and unit indicators
from names like this.

  -dave

On Jan 27, 2008, at 5:37 AM, ern_at_student.matnat.uio.no wrote:

> Hi all,
> I have hourly mm5-grib files which I am reading by using the
> "addfiles"
> and "addfiles_GetVar" functions. This works fine for all variables
> except
> for the accumulated precipitation.
> These variables:
> "NCPCP_GDS0_HTGL_acc1h" and "ACPCP_GDS0_HTGL_acc1h"
> change for every hour/file.
> These examples are for run hour number 1.
> The number between "_acc" and "h" (1 in this example) is added by
> one for
> every new file so the next is called "NCPCP_GDS0_HTGL_acc2h" and so
> on...
> I tried to read the variables in some do-loop, but without success.
> Does anyone have any idea of how to read/store variables like these
> that
> change name in every new file?
> Thanks for any help!
> /Erik
>
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk_at_ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Jan 29 2008 - 13:04:13 MST

This archive was generated by hypermail 2.2.0 : Thu Jan 31 2008 - 22:46:00 MST