regrid problem

From: cheryl Ma <xiaoyancloud_at_nyahnyahspammersnyahnyah>
Date: Fri May 10 2013 - 08:58:26 MDT

Dear all,

I regrid a data file from 4*5 in binary format to 1*1 in nc file. I
plotted the data before and after regridding and found somehow the latitude
has been shifted, which is not what I expected. Below is my ncl script and
the plots are also attached. Does anybody know what's wrong with the script
and how to fix the problem?

Thanks,
Xiaoyan

===================================
begin
   nlat = 45
   nlon = 72
   setfileoption("bin","ReadByteOrder","BigEndian")
  var0 = new( (/nlat,nlon/), float)
  var0 = fbindirread( "1.dat",0, (/nlat,nlon/), "float")
  printVarSummary(var0)
;
lat=fspan(-90.0,90.0,nlat)
lon=fspan(-180.0,180.0,nlon)
print(lat)
print(lon)
;
;create a sequence for the new values of lat
newlat=fspan(-90.0,90.0,180)
;create a sequence for the new values of lon
newlon=fspan(-180.0,180.0,360)
newlat@units = "degrees_north"
newlon@units = "degrees_east"
var=linint2(lon,lat,var0,True,newlon,newlat,0)
var!0 = "LAT"
var!1 = "LON"
var&LAT = newlat
var&LON = newlon
printVarSummary(var)
fout=addfile("regrid_data.nc","c")
fout->var=var
;
end

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk

Received on Fri May 10 08:58:39 2013

This archive was generated by hypermail 2.1.8 : Wed May 15 2013 - 10:19:28 MDT