<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:arial, helvetica, sans-serif;font-size:12pt"><div>Let me try to regrid the files tomorrow and try calculating the values.</div><div><br></div><div>thanks again&nbsp;</div><div><br></div><div>henry</div><div style="font-family:arial, helvetica, sans-serif;font-size:12pt"><br><div style="font-family:times new roman, new york, times, serif;font-size:12pt"><font size="2" face="Tahoma"><hr size="1"><b><span style="font-weight: bold;">From:</span></b> Hang &lt;hang_hang2004@yahoo.com.hk&gt;<br><b><span style="font-weight: bold;">To:</span></b> GrADS Users Forum &lt;gradsusr@gradsusr.org&gt;<br><b><span style="font-weight: bold;">Sent:</span></b> Wed, January 26, 2011 11:32:53 PM<br><b><span style="font-weight: bold;">Subject:</span></b> Re: [gradsusr] Problem in loading variables in different files.<br></font><br><div style="font-family:arial, helvetica,
 sans-serif;font-size:12pt;"><div><span class="Apple-style-span" style="font-size:medium;">Doug,</span></div><div><span class="Apple-style-span" style="font-size:medium;"><br></span></div><div><span class="Apple-style-span" style="font-size:medium;">Oh, about the&nbsp;the error refers to vwnd10m, actually I have also defined it but I have forgotten to include that in my script. I wanted to simplify the question but I cut the wring part... sorry about that. Actually the define command I should put here should be&nbsp;&nbsp;&nbsp;</span>&nbsp;&nbsp; &nbsp; &nbsp;</div><div><br></div><div><b><i>&nbsp;&nbsp; &nbsp; &nbsp;'set lat 'lat1</i></b></div><div><b><i>&nbsp;&nbsp; &nbsp; &nbsp;'set lon 'lon1' 'lon2</i></b></div><div><i>&nbsp;&nbsp; &nbsp; &nbsp;'set t 'time</i></div><div><span class="Apple-style-span" style="font-size:medium;"><span class="Apple-style-span" style="font-size:16px;"><i>&nbsp;&nbsp; &nbsp; &nbsp;'set lev
 'level1</i></span><i>&nbsp;</i></span></div><div><i><span class="Apple-style-span" style="font-size:medium;"></span></i><span class="Apple-style-span" style="font-size:medium;"><i>&nbsp;&nbsp; &nbsp; &nbsp;'define wind=(ave(<b>vwnd.2,lon='lon1',lon='lon2'</b>)+ave(<b>vwnd10m,lon='lon1',lon='lon2'</b>))/2' &nbsp;</i></span></div><div><span class="Apple-style-span" style="font-size:medium;"><br></span></div><div><span class="Apple-style-span" style="font-size:medium;">&nbsp;&nbsp;&nbsp;</span><span class="Apple-style-span" style="font-size:medium;">in order to match the error message. ( the idea is more of less the same as the last one)</span></div><div><span class="Apple-style-span" style="font-size:medium;"><br></span></div><div><span class="Apple-style-span" style="font-size:medium;">So I think you are right that "Dimension = 1" may correspond
 to the difference in Xsize (vwnd.2 :&nbsp;Xsize = 144 &nbsp; and &nbsp; vwnd10m: &nbsp;Xsize&nbsp;= 192&nbsp;)</span></div><div><span class="Apple-style-span" style="font-size:13px;"><br></span></div><div><span class="Apple-style-span" style="font-size:medium;">Do you mean that multi level files and single level file cannot be combined together as well?</span></div><div><span class="Apple-style-span" style="font-size:medium;"><br></span></div><div><span class="Apple-style-span" style="font-size:medium;">And about fixing the lon value with lat varying&nbsp;</span><span class="Apple-style-span" style="font-size:medium;">(in the script &nbsp;included in the last mail)</span><span class="Apple-style-span" style="font-size:medium;">&nbsp;, because I want to find the flux across a certain vertical plane when analyzing &nbsp;a certain grid box. As I am a new user of GrADS, I do not know if this is the right way or the usual way, any better suggestions
 ?</span></div><div style="font-family:arial, helvetica, sans-serif;font-size:12pt;"><br></div><div style="font-family:arial, helvetica, sans-serif;font-size:12pt;">Thanks so much for your help&nbsp;</div><div style="font-family:arial, helvetica, sans-serif;font-size:12pt;"><br></div><div style="font-family:arial, helvetica, sans-serif;font-size:12pt;">Cheers,</div><div style="font-family:arial, helvetica, sans-serif;font-size:12pt;">Henry<br><div style="font-family:arial, helvetica, sans-serif;font-size:13px;"><font size="2" face="Tahoma"><hr size="1"><b><span style="font-weight:bold;">From:</span></b> "Clark, Douglas B." &lt;dbcl@ceh.ac.uk&gt;<br><b><span style="font-weight:bold;">To:</span></b> GrADS Users Forum &lt;gradsusr@gradsusr.org&gt;<br><b><span style="font-weight:bold;">Sent:</span></b> Wed, January 26, 2011 5:42:14 PM<br><b><span style="font-weight:bold;">Subject:</span></b> Re: [gradsusr] Problem in loading variables in different
 files.<br></font><br>Henry,<br><br>Actually...I'm not so sure exactly what your problem is!&nbsp; It has been a while since I tried to use different grids and I have forgotten the details. Some further suggestions:<br><br>I noticed that your first grid has same x and y sizes as grids 4 onwards, so perhaps the horizontal grid isn't the problem. The answer probably lies in the dimension bit of the error message "Variable = vwnd10m&nbsp; Dimension = 1", but I don't know how to interpret the dimension number here. Dim1 sounds like a horizontal thing, but I'm not sure. Also the error refers to vwnd10m, so it doesn't relate to the define command you listed below (I had assumed it did). But the later files have multiple levels, so perhaps the problem relates to the levels.<br><br>Also I notice that you fix the lon value, but have lat varying, and then calculate an average over latitude, which looks a bit strange (you could also fix lat) but should
 work.<br><br>No answers here I'm afraid, just some thoughts.<br><br>Doug<br><br><br><br><br>From: <a rel="nofollow" ymailto="mailto:gradsusr-bounces@gradsusr.org" target="_blank" href="mailto:gradsusr-bounces@gradsusr.org">gradsusr-bounces@gradsusr.org</a> [mailto:<a rel="nofollow" ymailto="mailto:gradsusr-bounces@gradsusr.org" target="_blank" href="mailto:gradsusr-bounces@gradsusr.org">gradsusr-bounces@gradsusr.org</a>] On Behalf Of Clark, Douglas B.<br>Sent: 26 January 2011 09:10<br>To: GrADS Users Forum<br>Subject: Re: [gradsusr] Problem in loading variables in different files.<br><br>Henry,<br><br>Yes, I think your problem is that you are trying to use variables that are on different grids, as you suggested.<br>(This would only work if one grid was a subset of the other.)<br><br>You can do calculations on these variables separately, but you can't combine them (e.g. sum them).<br><br>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.<br><br>(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.)<br><br>Doug<br><br><br>From: <a rel="nofollow" ymailto="mailto:gradsusr-bounces@gradsusr.org" target="_blank" href="mailto:gradsusr-bounces@gradsusr.org">gradsusr-bounces@gradsusr.org</a> [mailto:<a rel="nofollow" ymailto="mailto:gradsusr-bounces@gradsusr.org" target="_blank" href="mailto:gradsusr-bounces@gradsusr.org">gradsusr-bounces@gradsusr.org</a>] On Behalf Of Hang<br>Sent: 26 January 2011 08:51<br>To: <a rel="nofollow" ymailto="mailto:gradsusr@gradsusr.org" target="_blank" href="mailto:gradsusr@gradsusr.org">gradsusr@gradsusr.org</a><br>Subject: [gradsusr] Problem in loading variables in different
 files.<br><br>Hi,<br>&nbsp;<br>I want to do some calculations using the values in different files but an error message
 was shown :<br>&nbsp;<br>Data Request Error: Invalid grid coordinates<br>&nbsp; World coordinates convert to non-integer&nbsp; grid coordinates<br>&nbsp;&nbsp;&nbsp; Variable = vwnd10m&nbsp; Dimension = 1 <br>Operation Error:&nbsp; Error from ave function<br>&nbsp; Error ocurred at column 32<br>DEFINE error:&nbsp; Invalid expression. <br>&nbsp;<br>The following&nbsp;are the main components&nbsp;of my script:<br>&nbsp;<br>&nbsp;<br>'sdfopen /home2/h08hang/redata/uwnd10m.mon.mean.nc'<br>'set lat -90 90'<br>'set lon 0 360'<br>'set t 1 753'<br>'define uwnd10m=uwnd'<br>'close 1'<br>&nbsp;<br>'sdfopen /home2/h08hang/redata/vwnd10m.mon.mean.nc'<br>'set lat -90 90'<br>'set lon 0 360'<br>'set t 1 753'<br>'define vwnd10m=vwnd'<br>'close 1'<br>&nbsp;<br>'sdfopen /home2/h08hang/redata/shum2m.mon.mean.nc'<br>'set lat -90 90'<br>'set lon 0 360'<br>'set t 1 753'<br>'define shum2m=shum'<br>'close 1'<br><br>'sdfopen
 /home2/h08hang/redata/uwnd.mon.mean.nc'<br><br>'sdfopen /home2/h08hang/redata/vwnd.mon.mean.nc'<br>&nbsp;<br>'sdfopen /home2/h08hang/redata/shum.mon.mean.nc'<br>&nbsp;<br>....<br>&nbsp;&nbsp; <br>&nbsp;&nbsp; lon1=112.5<br>&nbsp;&nbsp; lon2=115<br>&nbsp;&nbsp; lat1=22.5<br>&nbsp;&nbsp; lat2=25<br>&nbsp;<br>&nbsp;&nbsp; 'set lat 'lat1' 'lat2<br>&nbsp;&nbsp; 'set lon 'lon1<br>&nbsp;&nbsp; 'set t 'time<br>&nbsp;&nbsp; 'set lev 'level1<br>&nbsp;<br>&nbsp;&nbsp; 'define wind=(ave(uwnd.1,lat='lat1',lat='lat2')+ave(uwnd10m,lat='lat1',lat='lat2'))/2'<br>&nbsp;<br>&nbsp;<br>&nbsp;<br>&nbsp;<br>&nbsp;<br>For the first three files I opened (uwnd10m,vwnd10m,shum2m), the variables are uwnd,vwnd and shum respectively.&nbsp; 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)<br>&nbsp;<br>For the next three files I
 opened, they have a different Grids&nbsp;as shown below. Is this the reason why I cannot run my script, or something else?<br>But what I want is to use the values from different files (those with different Grids to do my&nbsp;calculation)&nbsp; How can I solve this? <br>&nbsp;<br>Can anyone give me some help? Thanks&nbsp;a lot (and sorry for the lengthy question)<br>&nbsp;<br>&nbsp;<br>File 1 : NCEP Reanalysis monthly ltm surface pressure<br>&nbsp; Descriptor: /home2/h08hang/redata/pres.mon.mean.nc<br>&nbsp; Binary: /home2/h08hang/redata/pres.mon.mean.nc<br>&nbsp; Type = Gridded<br>&nbsp; Xsize = 144&nbsp; Ysize = 73&nbsp; Zsize = 1&nbsp; Tsize = 756&nbsp; Esize = 1<br>&nbsp; Number of Variables = 1<br>&nbsp;&nbsp;&nbsp; pres 0 -103 Monthly Mean of Surface Pressure<br>File 2 : monthly mean u wind<br>&nbsp; Descriptor: /home2/h08hang/redata/uwnd10m.mon.mean.nc<br>&nbsp; Binary: /home2/h08hang/redata/uwnd10m.mon.mean.nc<br>&nbsp; Type = Gridded<br>&nbsp;
 Xsize = 192&nbsp; Ysize = 94&nbsp; Zsize = 1&nbsp; Tsize = 756&nbsp; Esize = 1<br>&nbsp; Number of Variables = 1<br>&nbsp;&nbsp;&nbsp; uwnd 0 -103 Monthly Mean of U-Wind<br>File 3 : monthly mean u wind<br>&nbsp; Descriptor: /home2/h08hang/redata/vwnd10m.mon.mean.nc<br>&nbsp; Binary: /home2/h08hang/redata/vwnd10m.mon.mean.nc<br>&nbsp; Type = Gridded<br>&nbsp; Xsize = 192&nbsp; Ysize = 94&nbsp; Zsize = 1&nbsp; Tsize = 756&nbsp; Esize = 1<br>&nbsp; Number of Variables = 1<br>&nbsp;&nbsp;&nbsp; vwnd 0 -103 Monthly Mean V wind at 10 m<br>&nbsp;<br>File 4 : monthly mean u wind from the NCEP Reanalysis<br>&nbsp; Descriptor: /home2/h08hang/redata/uwnd.mon.mean.nc<br>&nbsp; Binary: /home2/h08hang/redata/uwnd.mon.mean.nc<br>&nbsp; Type = Gridded<br>&nbsp; Xsize = 144&nbsp; Ysize = 73&nbsp; Zsize = 17&nbsp; Tsize = 751&nbsp; Esize = 1<br>&nbsp; Number of Variables = 1<br>&nbsp;&nbsp;&nbsp; uwnd 17 -103 Monthly mean u wind<br>File 5 : monthly mean v wind from the
 NCEP Reanalysis<br>&nbsp; Descriptor: /home2/h08hang/redata/vwnd.mon.mean.nc<br>&nbsp; Binary: /home2/h08hang/redata/vwnd.mon.mean.nc<br>&nbsp; Type = Gridded<br>&nbsp; Xsize = 144&nbsp; Ysize = 73&nbsp; Zsize = 17&nbsp; Tsize = 751&nbsp; Esize = 1<br>&nbsp; Number of Variables = 1<br>&nbsp;&nbsp;&nbsp; vwnd 17 -103 Monthly mean v wind<br>File 6 : 4x daily NMC reanalysis<br>&nbsp; Descriptor: /home2/h08hang/redata/shum.mon.mean.nc<br>&nbsp; Binary: /home2/h08hang/redata/shum.mon.mean.nc<br>&nbsp; Type = Gridded<br>&nbsp; Xsize = 144&nbsp; Ysize = 73&nbsp; Zsize = 8&nbsp; Tsize = 752&nbsp; Esize = 1<br>&nbsp; Number of Variables = 1<br>&nbsp;&nbsp;&nbsp; shum 8 -103 Monthly Mean of Specific Humidity<br>&nbsp;<br>Best,<br>Henry<br><br><br>-- <br>This message (and any attachments) is for the recipient only. NERC <br>is subject to the Freedom of Information Act 2000 and the contents <br>of this email and any reply you make may be disclosed by NERC unless
 <br>it is exempt from release under the Act. Any material supplied to <br>NERC may be stored in an electronic records management system.<br><br>_______________________________________________<br>gradsusr mailing list<br><a rel="nofollow" ymailto="mailto:gradsusr@gradsusr.org" target="_blank" href="mailto:gradsusr@gradsusr.org">gradsusr@gradsusr.org</a><br><a rel="nofollow" target="_blank" href="http://gradsusr.org/mailman/listinfo/gradsusr">http://gradsusr.org/mailman/listinfo/gradsusr</a><br></div></div><div style=""></div>


</div><br></div></div><div style="position:fixed"></div>


</div><br></body></html>