[gradsusr] Problem in loading variables in different files.

Clark, Douglas B. dbcl at ceh.ac.uk
Wed Jan 26 04:10:21 EST 2011


Henry,

Yes, I think your problem is that you are trying to use variables that are on different grids, as you suggested.
(This would only work if one grid was a subset of the other.)

You can do calculations on these variables separately, but you can't combine them (e.g. sum them).

Chances are that you will need to regrid some variables to get everything on the same grid. In GrADS, you can regrid using the regrid UDF (user defined function - only available with some versions of GrADS I think) or you could regrid using some other package outside of GrADS.

(By the way, I notice your file #1 has different xsize and ysize from files #2 and 3, which might be fine, but check that this also doesn't give you unexpected results.)

Doug


From: gradsusr-bounces at gradsusr.org [mailto:gradsusr-bounces at gradsusr.org] On Behalf Of Hang
Sent: 26 January 2011 08:51
To: gradsusr at gradsusr.org
Subject: [gradsusr] Problem in loading variables in different files.

Hi,

I want to do some calculations using the values in different files but an error message was shown :

Data Request Error: Invalid grid coordinates
  World coordinates convert to non-integer  grid coordinates
    Variable = vwnd10m  Dimension = 1
Operation Error:  Error from ave function
  Error ocurred at column 32
DEFINE error:  Invalid expression.

The following are the main components of my script:


'sdfopen /home2/h08hang/redata/uwnd10m.mon.mean.nc'
'set lat -90 90'
'set lon 0 360'
'set t 1 753'
'define uwnd10m=uwnd'
'close 1'

'sdfopen /home2/h08hang/redata/vwnd10m.mon.mean.nc'
'set lat -90 90'
'set lon 0 360'
'set t 1 753'
'define vwnd10m=vwnd'
'close 1'

'sdfopen /home2/h08hang/redata/shum2m.mon.mean.nc'
'set lat -90 90'
'set lon 0 360'
'set t 1 753'
'define shum2m=shum'
'close 1'

'sdfopen /home2/h08hang/redata/uwnd.mon.mean.nc'

'sdfopen /home2/h08hang/redata/vwnd.mon.mean.nc'

'sdfopen /home2/h08hang/redata/shum.mon.mean.nc'

....

   lon1=112.5
   lon2=115
   lat1=22.5
   lat2=25

   'set lat 'lat1' 'lat2
   'set lon 'lon1
   'set t 'time
   'set lev 'level1

   'define wind=(ave(uwnd.1,lat='lat1',lat='lat2')+ave(uwnd10m,lat='lat1',lat='lat2'))/2'





For the first three files I opened (uwnd10m,vwnd10m,shum2m), the variables are uwnd,vwnd and shum respectively.  I define three new variables to store them as their varable name crash with the next three file I am going to open. I close the each file after I have defined the new variables (for the first three files)

For the next three files I opened, they have a different Grids as shown below. Is this the reason why I cannot run my script, or something else?
But what I want is to use the values from different files (those with different Grids to do my calculation)  How can I solve this?

Can anyone give me some help? Thanks a lot (and sorry for the lengthy question)


File 1 : NCEP Reanalysis monthly ltm surface pressure
  Descriptor: /home2/h08hang/redata/pres.mon.mean.nc
  Binary: /home2/h08hang/redata/pres.mon.mean.nc
  Type = Gridded
  Xsize = 144  Ysize = 73  Zsize = 1  Tsize = 756  Esize = 1
  Number of Variables = 1
    pres 0 -103 Monthly Mean of Surface Pressure
File 2 : monthly mean u wind
  Descriptor: /home2/h08hang/redata/uwnd10m.mon.mean.nc
  Binary: /home2/h08hang/redata/uwnd10m.mon.mean.nc
  Type = Gridded
  Xsize = 192  Ysize = 94  Zsize = 1  Tsize = 756  Esize = 1
  Number of Variables = 1
    uwnd 0 -103 Monthly Mean of U-Wind
File 3 : monthly mean u wind
  Descriptor: /home2/h08hang/redata/vwnd10m.mon.mean.nc
  Binary: /home2/h08hang/redata/vwnd10m.mon.mean.nc
  Type = Gridded
  Xsize = 192  Ysize = 94  Zsize = 1  Tsize = 756  Esize = 1
  Number of Variables = 1
    vwnd 0 -103 Monthly Mean V wind at 10 m

File 4 : monthly mean u wind from the NCEP Reanalysis
  Descriptor: /home2/h08hang/redata/uwnd.mon.mean.nc
  Binary: /home2/h08hang/redata/uwnd.mon.mean.nc
  Type = Gridded
  Xsize = 144  Ysize = 73  Zsize = 17  Tsize = 751  Esize = 1
  Number of Variables = 1
    uwnd 17 -103 Monthly mean u wind
File 5 : monthly mean v wind from the NCEP Reanalysis
  Descriptor: /home2/h08hang/redata/vwnd.mon.mean.nc
  Binary: /home2/h08hang/redata/vwnd.mon.mean.nc
  Type = Gridded
  Xsize = 144  Ysize = 73  Zsize = 17  Tsize = 751  Esize = 1
  Number of Variables = 1
    vwnd 17 -103 Monthly mean v wind
File 6 : 4x daily NMC reanalysis
  Descriptor: /home2/h08hang/redata/shum.mon.mean.nc
  Binary: /home2/h08hang/redata/shum.mon.mean.nc
  Type = Gridded
  Xsize = 144  Ysize = 73  Zsize = 8  Tsize = 752  Esize = 1
  Number of Variables = 1
    shum 8 -103 Monthly Mean of Specific Humidity

Best,
Henry

-- 
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20110126/78f4acab/attachment-0003.html 


More information about the gradsusr mailing list