Re: questions about rcm2rgrid

From: moetasim <moetasim_at_nyahnyahspammersnyahnyah>
Date: Mon, 2 Apr 2007 05:01:34 +0500

A small clarification on my previous note:
The newlat and newlon of new grid are defined in degree units whereas RegCM3 grid is defined in km units. Therefore, 50 km and 25 km do not correspond exactly to the 0.5 and 0.25 multipliers in newlat newlon declaration. In fact, the new grid would be slightly lower/higher in resolution than the RegCM3 grid, based on these declarations.

Moet
 
>The outhead file used in this script is generated by running lats4d script, which uses information from CTL file to convert data from grads to netcdf format, on OUTHEAD (OUTHEAD.CTL) file in Grads. This CTL file doesn't represent the actual RegCM3 grid. Instead, it uses a finer grid (xdef,ydef in OUTHEAD.CTL) for plotting in Grads. Therefore, the lat2d and lon2d (xlat,xlon) in this header file do not match with the lat lon dimensions of the SRF file.
>
>The post-processing code of RegCM3 generates the HEAD_OUT file in netcdf format, which contains the real lat2d and lon2d for the RegCM3 grid. Those lat2d and lon2d should be used with rcm2rgrid function to avoid any problem.
>
>Secondly, the sample script that I had provided on RegCNET was for regridding RegCM3 25 km Rotated Mercator projected data on 25 km lat lon grid. If regridding at 25 km is not desired then the declaration of newlat and newlon should be changed accordingly e.g. for 50 km resolution
>
>newlon = 50 + (0.5 * ispan(0,279,1))
>newlat = -5 + (0.5 * ispan(0,199,1))
>
>The choice of newlon(0)=50 and newlat(0)=-5 was also arbitary in that script and should be changed (if regridding of whole grid is desired) according to the grid of simulation. Please note that domxmin, domymin, domxmax and domymax in post-processed RegCM3 netcdf file do not match exactly with the actual domain of the simulation. Therefore, the extreme lat and lon points should be checked by using ncdump on xlat and xlon in HEAD_OUT file. Since RegCM3 grid is map projected, it is advisable to set the boundaries of the desired lat lon grid further away from the extreme xlat and xlon values.
>
>Moet
>EAS, Purdue
>
>>
>>Dear Siraj,
>>
>>Just an friendly reminder: when responding to ncl-talk, please change
>>the subject header from "Re: ncl-talk Digest, Vol 40, Issue 42" to
>>something more meaningful for the topic you are posting about. I've
>>taken the liberty of changing the subject header of this message.
>>
>>As the error message indicates, the first argument (referred to as
>>"parameter (0)" in the error message, which I find very confusing)
>>must be 2-dimensional.
>>
>>>From the looks of your script, you are doing this correctly, as your
>>lat2d and lon2d arrays both appear to be 2-dimensional. I
>>double-checked the routine on our end and it appears to be working.
>>
>>To help me debug this, right before the call to "rcm2rgrid", can you
>>put the following in your script, and email me the output (you can
>>just email it to me personally):
>>
>> printVarSummary(lat2d)
>> printVarSummary(lon2d)
>>
>>Also, can you email me the version number of NCL that you are running?
>>
>>Finally, here's a small way that you can clean up your script
>>slightly. You can replace the following code:
>>
>> newlon = new((/280/),typeof(lon2d))
>> newlat = new((/200/),typeof(lat2d))
>>
>> do j=0,279
>> newlon(j)= 50+(0.25)*j
>> end do
>>
>> do i=0,199
>> newlat(i)=-5+(0.25)*i
>> end do
>>
>>with:
>>
>> newlon = 50 + (0.25 * ispan(0,279,1))
>> newlat = -5 + (0.25 * ispan(0,199,1))
>>
>>
>>--Mary
>>
>>On Thu, 29 Mar 2007, Siraj Ul Islam wrote:
>>
>>> Dear All,
>>>
>>> We have been trying to run the NCL script to convert ROTMER monthly
>>> postprocessed output of RegCM3 into regular lat long grid. But find
>>> the following error.
>>> ------------------------------------------------
>>>
>>> [root_at_localhost root]# ncl rcm2grid.ncl
>>>
>>> fatal:Number of dimensions in parameter (0) of (rcm2rgrid) is (3), (2)
>>> dimensions were expected
>>>
>>> fatal:Execute: Error occurred at or near line 38 in file rcm2grid.ncl
>>> -----------------------------------------------
>>>
>>> nc dump files of the outhead.nc and surface.nc file used in the script.
>>> Also the script for this convertion is also pasted at the end.
>>>
>>> thanks in advance,
>>>
>>> Regards,
>>> ----------------------------------------------
>>> ------------------------------------------------
>>> [root_at_localhost root]# ncl_filedump outhead.nc
>>> Variable: f (file variable)
>>> filename: outhead
>>> path: outhead.nc
>>> file global attributes:
>>> Conventions : COARDS
>>> calendar : standard
>>> comments : file created by grads using lats4d available from
>>> http://dao.gsfc.nasa.gov/sofware/grads/lats4d/
>>> model : geos/das
>>> center : gsfc
>>> dimensions:
>>> time = 1 // unlimited
>>> longitude = 303
>>> latitude = 226
>>> variables:
>>> double time ( time )
>>> units : hours since 2001-1-1 0
>>>
>>> -----------------------------------------------------
>>> ----------------------------------------------------
>>> filename: SRF
>>> path: SRF.nc
>>> file global attributes:
>>> domxmin : 52.37275
>>> domxmax : 108.0947
>>> domymin : -2.378861
>>> domymax : 44.79095
>>> domzmin : 1050
>>> domzmax : 1050
>>> dimensions:
>>> lon = 118
>>> lat = 109
>>> time = 132 // unlimited
>>> variables:
>>> float lon ( lon )
>>> long_name : Longitude
>>> units : degrees_east
>>> actual_range : <ARRAY>
>>>
>>> float lat ( lat )
>>> long_name : Latitude
>>> units : degrees_north
>>> actual_range : <ARRAY>
>>>
>>> -----------------------------------------------------------
>>>
>>> NCL SCRIPT
>>>
>>> -----------------------------------------------------------
>>>
>>> load "/usr/local/lib/ncarg/nclscripts/csm/gsn_code.ncl"
>>>
>>> load "/usr/local/lib/ncarg/nclscripts/csm/shea_util.ncl"
>>>
>>> load "/usr/local/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
>>>
>>> load "/usr/local/lib/ncarg/nclscripts/csm/contributed.ncl"
>>>
>>> ;********************************************
>>>
>>> begin
>>>
>>> dirhead="/root/"
>>>
>>> filhead="outhead.nc"
>>>
>>> dirrcm="/root/"
>>>
>>> filrcm="SRF.nc"
>>>
>>> fhead=addfile(dirhead+filhead,"r")
>>>
>>> f1 = addfile(dirrcm+filrcm,"r")
>>>
>>> var = f1->RT
>>>
>>> lat2d = fhead->xlat(0,:,:)
>>>
>>> lon2d = fhead->xlong(0,:,:)
>>>
>>> newlon = new((/280/),typeof(lon2d))
>>>
>>> newlat = new((/200/),typeof(lat2d))
>>>
>>> do j=0,279
>>>
>>> newlon(j)= 50+(0.25)*j
>>>
>>> end do
>>>
>>> do i=0,199
>>>
>>> newlat(i)=-5+(0.25)*i
>>>
>>> end do
>>>
>>> newvar = rcm2rgrid(lat2d,lon2d,var,newlat,newlon,0)
>>>
>>> end
>>>
>>> ------------------------------------------------
>>>
>>_______________________________________________
>>ncl-talk mailing list
>>ncl-talk_at_ucar.edu
>>http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>
>
>
>
>
>________________________________________________________________
>Sent via the WebMail system at gcisc.org.pk
>
>
>
>
>_______________________________________________
>ncl-talk mailing list
>ncl-talk_at_ucar.edu
>http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
 

________________________________________________________________
Sent via the WebMail system at gcisc.org.pk

 
                   
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Sun Apr 01 2007 - 18:01:34 MDT

This archive was generated by hypermail 2.2.0 : Tue Apr 03 2007 - 09:49:39 MDT