rcm2rgrid problem

From: IMRAN NADEEM <qphoton_at_nyahnyahspammersnyahnyah>
Date: Thu, 23 Oct 2008 14:46:11 +0200

Hi everybody,

   I have precipitation fields from RegCM3 and MM5 models. I have written a
script to interpolate from model grid to regular grid. The script works fine
for RegCM3 data
but produces only missing values for mm5 data. Both datasets covers the same
region and have almost same number of grid points. The script is given below
and few time
steps of both datasets are here (Size 600KB).

http://homepage.boku.ac.at/imrannad/Precip_regcm.nc
http://homepage.boku.ac.at/imrannad/Precip_mm5.nc

Any Help/Suggestion is highly appreciated!

Regards
Imran Nadeem
BOKU, Vienna

------------------------------
------------------------Rcm2rgrid.ncl----------------------------------------------

load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"

begin

; ---------Read input file--------------------
 filein="Precip_regcm.nc" ; input file
 data_file= addfile(filein,"r")

 precip = data_file->precip
 lat2d = data_file->xlat
 lon2d = data_file->xlon
 time =data_file->time

 lat_g = latGlobeF(901, "lat", "latitude", "degrees_north")
;0.20 degree spacing
 lon_g = lonGlobeF(1800, "lon", "longitude", "degrees_east") ;0.20
degree spacing

 newlon = lon_g({2:19})
 newlat = lat_g({42:50})

 precip_rgrid = rcm2rgrid(lat2d,lon2d,precip,newlat,newlon,0) ;
Regridding

;---------------- assign named dimensions----------------
  precip_rgrid!0 = "time"
  precip_rgrid!1 = "lat"
  precip_rgrid!2 = "lon"

;---------------- assign attributes----------------
  precip_rgrid_at_long_name="Precipitation on Regular Grid"
  precip_rgrid_at_units="mm/day"
  precip_rgrid@_FillValue=-1.e+30

;---------------- assign coordinate variables----------------
  precip_rgrid&lat = newlat
  precip_rgrid&lon = newlon
  precip_rgrid&time =time

;-----------create output file---------------
 outfile_name = "Precip_regcm_rgrid.nc"
 system(" 'rm' -f " + outfile_name)
 outfile = addfile(outfile_name, "c")
 filedimdef(outfile,"time",-1,True) ; make time and
record dimension.
 outfile_at_title = "regcm precip on regular lat lon"

;------------write to output file---------------
 outfile->precip = precip_rgrid
 outfile->lon=newlon
 outfile->lat=newlat

end
<http://homepage.boku.ac.at/imrannad/Precip_mm5.nc>

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Oct 23 2008 - 06:46:11 MDT

This archive was generated by hypermail 2.2.0 : Fri Oct 24 2008 - 14:07:49 MDT