linint2_Wrap Regriding

From: Ping Yang <pyang_at_nyahnyahspammersnyahnyah>
Date: Thu May 17 2012 - 10:26:36 MDT

Dear NCL user,

I am doing interpolation from the PSD data(daily T62 Gaussian grid (192x94)
88.542N - 88.542S, 0E - 358.125E) to a 3 minute*3minute lon/lat regular
grid, I have encountered an issue with the bilinear interpolation with the
linint2_Wrap function (Interpolates from a rectilinear grid to another
rectilinear grid using bilinear interpolation, and retains metadata)with
NCL, because I've got invalid values(some of of the value are null). I used
this code (I used a NCEP/NCAR reanalysis data, which is available by this
link
ftp://ftp.cdc.noaa.gov/Datasets/ncep.reanalysis.dailyavgs/surface_gauss/pres.sfc.gauss.2006.nc)
:

;*************************************************
; interpolation.ncl
;
; Concepts illustrated:
; - Interpolating from one grid to another using bilinear interpolation
; use linint2_Wrap function for the retrieving all the metadata
;create a new file to include the interpolated variable
;
;************************************************
load "/usr/local/lib/ncarg/nclscripts/csm/contributed.ncl"
;load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
;change $NCARG_ROOT to /usr/local directly.
;************************************************
begin
;open file to write variable to(a new netCDF file)
out=addfile("pres.sfc.gauss.2006.interpolated.nc","c")
;************************************************
; read in netCDF file
;************************************************
  in = addfile("pres.sfc.gauss.2006.nc","r")
;************************************************
; read in pres
;***********************************************
;Use a subscript for change the dimension of pressure and also subset the
variable
  pres=in->pres(time|:,{lat|34.875:50.125},{lon|95.975:115.125})
;so the newPres is with the latitude increasing
;***********************************************************
;newlon = fspan(-84.025,-64.875,383)
newlon = fspan(95.975,115.125,383);convert to a (0,360) instead of
(-180,+180)
newlat = fspan(34.875,50.125,305)
newlat@units = "degrees_north"
newlon@units = "degrees_east"
;************************************************
; interpolate to new grid use linint2_Wrap function
;***********************************************
  newsst=linint2_Wrap(pres&lon,pres&lat,pres,True,newlon,newlat,0)
;*************output variable to new file****************
 out->pres=newsst
end

Actually I need the domain range is from lon(-84.025,-64.875,383),
lat(34.875,50.125,305) in the lon/lat regular grid, Can I ask you what will
be the correct range in the Gaussian grid lon 95.975:115.125? I tried
several times, it seems that I am confused by the translation,

Am I use the right function for this interpolation? I will be appreciated
if you can point out where is the problem ?

Best Regards,

Ping

-- 
Ping Yang, Ph.D.
CUNY Environmental Crossroads Initiative
Marshak Science Building - Suite 925
The City College of New York - CUNY
160 Convent Avenue, New York NY 10031
Phone: 212-650-5769
Fax: 212-650-7064

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu May 17 10:26:50 2012

This archive was generated by hypermail 2.1.8 : Thu May 17 2012 - 13:42:02 MDT