Re: Data regriding question

From: Will Hobbs <Will.Hobbs_at_nyahnyahspammersnyahnyah>
Date: Fri Mar 29 2013 - 18:08:08 MDT

Durga

A couple of quick suggestions:

  1. For the linint2 function, the input and output coordinates must be monotonically INCREASING. I can see that your 'newlat' array runs from 90 to -90 (i.e. is decreasing). You will also need to check that the input lat/lon arrays don't need to be reversed.

2. Your output 'newlon' array runs from 0-360. It's quite possible that the input data lon array runs from -180 to 180; if this is the case you'll need to change your newlon array or half your data points will be __FillValues.

Will

From: Durga Kafle <dnkafle@gmail.com<mailto:dnkafle@gmail.com>>
Date: Saturday, 30 March 2013 11:01 AM
To: "ncl-talk@ucar.edu<mailto:ncl-talk@ucar.edu>" <ncl-talk@ucar.edu<mailto:ncl-talk@ucar.edu>>
Subject: Data regriding question

Hello,

I am trying to interpolate 20 CR precipitation data using linint2_Wrap function. The data is gaussian gridded. I would like to interpolate to a fixed grid. I have tried a few other functions as well (g2fsh_Wrap, linint2_Wrap etc). I get all Fillvalues (-32767) when I print the interpolated "prate". I am attaching the script here. I am just a beginner in ncl and would appreciate any help with this.
Thanks,
Durga

;regrid_pprate.ncl

load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
;************************************************
begin
;************************************************
; read in netCDF file
;************************************************
  cdf_file = addfile("/Volumes/HD2/UCR/Data/20CR/prate.mon.mean.nc<http://prate.mon.mean.nc/>","r")

  lon=cdf_file->lon
  lat=cdf_file->lat
  prate=cdf_file->prate

;************************************************
; interpolate to new grid
;***********************************************
  prate@_FillValue= -32767h

  newlat = fspan(90.0,-90,96)
  newlon = fspan(0.,358.,144)

  prate1 = short2flt(prate(0,:,:))
 ; print(prate1)
 ; prate2 =flt2dble(prate1)
; printVarSummary(prate1)

; do ne=0,0
 ; newprate = linint2(lon,lat,prate1,False,newlon,newlat,0)
  newprate = linint2_Wrap(lon,lat,prate1,False,newlon,newlat,0)
; end do
; newsst!0 ="lat"
; newsst!1 = "lon"
; newsst&lat = newlat
; newsst&lon = newlon
print(prate1(:,50)*1e5)

print(newprate(:,50)*1e5)
end

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Mar 29 18:08:31 2013

This archive was generated by hypermail 2.1.8 : Tue Apr 02 2013 - 21:23:48 MDT