Re: Half of Data is FillValue after regridding (linint2_Wrap)

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Mon Jun 18 2012 - 09:54:18 MDT

Hi Chris,

The issue is simply that you flipped the data (via "lonFlip"), and hence flipped the longitudes, but then instead of using the flipped longitudes in the regridding call, you used the original ones on the file.

To fix, change:

  lonv = in->lon
  latv = in->lat

to:

  lonv = Tv&lon
  latv = Tv&lat

Just for fun, I tried the regridding using the new ESMF regridding features. This way you can specify "5x5" as the output grid, rather than generating "newlat" and "newlon".

To do this, you must be using V6.1.0-beta or later. I changed:

  newlat = fspan(-90,90,37)
  newlon = fspan(-180,180,73)
  newlat@units = "degrees_north"
  newlon@units = "degrees_east"

  newT = linint2_Wrap(lonv,latv,Tv,False,newlon,newlat,0)

  newT!0 = "lat"
  newT!1 = "lon"
  newT&lat = newlat
  newT&lon = newlon

to:

  Opt = True
  Opt@DstGridType = "5x5" ; destination grid
  Opt@CopyVarCoords = True
  Opt@ForceOverwrite = True
  Opt@Debug = True

  newT = ESMF_regrid(Tv,Opt)

See the attached script and image. This script can only be run if you have NCL V6.1.0-beta or later.

--Mary

On Jun 16, 2012, at 2:24 PM, Christopher Danek wrote:

> Hi NCL,
>
> I try to regrid Temperature data with a simple linint2_Wrap.
> Everything is fine except that in the regrid-plot the half of the data is filled with the FillValue (uncomment print(newT) in code).
> Have anyone an idea what's wrong?
>
> If you compare the plots of original and regridded data the regridded are obviously moved to the east around half the globe.
>
> Thanks a lot
> Chris
>
> See Code:
> ---------------------------------------------------------------------------------------------------------------------
> in = addfile("T2m.nc", "r") ; http://www.ncl.ucar.edu/Applications/Data/cdf/T2m.nc
> Ti = in->T(0,:,:)
> print("all data missing Ti? " + all(ismissing(Ti)))
> printVarSummary(Ti)
> ;print(Ti)
> Tv = lonFlip(Ti)
> printVarSummary(Tv)
> print("all data missing Tv? " + all(ismissing(Tv)))
> print("min Tv: " + min(Tv))
> print("max Tv: " + max(Tv))
> ;print(Tv)
> lonv = in->lon
> latv = in->lat
> ;************************************************
> ; interpolate to new grid
> ;***********************************************
> newlat = fspan(-90,90,37)
> ;printVarSummary(newlat)
> ;print(newlat)
> newlon = fspan(-180,180,73)
> ;printVarSummary(newlon)
> ;print(newlon)
> newlat@units = "degrees_north"
> newlon@units = "degrees_east"
>
> newT = linint2_Wrap(lonv,latv,Tv,False,newlon,newlat,0)
>
> printVarSummary(newT)
> print("all data missing newT? " + all(ismissing(newT)))
> ;print(newT)
> print("min newT: " + min(newT))
> print("max newT: " + max(newT))
>
> ;newT!0 = "time" ; must set
> newT!0 = "lat"
> newT!1 = "lon"
> newT&lat = newlat
> newT&lon = newlon
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Jun 18 09:56:55 2012

This archive was generated by hypermail 2.1.8 : Mon Jun 25 2012 - 09:57:23 MDT