[ncl-talk] Missing values are regridded?

Mary Haley haley at ucar.edu
Tue Feb 17 13:52:17 MST 2015


Hi,

I'm not sure why the area_conserve_remap function is not working. However,
the documentation for this function states:

   "Missing values, designated by the _FillValue attribute, are *not*
allowed. If any missing
    values are encountered, the remap will not be performed for that grid."

I take this to mean that it should have returned *all* missing values,
which apparently it didn't. I will file a ticket on this. I think, though,
you cannot use this routine if you have missing values.

Meanwhile, you can try *ESMF_regrid* instead.  I've created a new script
for you, based on your original script, that uses "bilinear",
"conservative", and "nearest neighbor" methods for regridding.

You need to replace this code:

regrid = area_conserve_remap_Wrap(t&lon,t&lat,t,newlon,newlat,False)

with this code:

opt                = True
opt at DstGridLat     = newlat
opt at DstGridLon     = newlon
opt at ForceOverwrite = True
opt at InterpMethod   = "conserve"

regrid             = ESMF_regrid(t,opt)

​Please see the attached "regrid_and_plot.ncl" script, which uses
ESMF_regrid for the three methods, and creates a panel plot.

​--Mary


On Tue, Feb 17, 2015 at 12:50 PM, Jiang, Lifen <lfjiang at ou.edu> wrote:

>                   Hello,
>
>  I am regridding "y" (lat, lon) to 1 degree grids. My codes always re-map
> the missing values as well (-999) as the printed min is -994.176, which
> should be a positive number.
>
>  My code is enclosed below and my data file is attached.
>
>  Could anybody help me to find why missing function doesn't work?
>
>  Thanks for your time!
>
>  Lifen
>
>  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
> fili = "2000_MPI-ESM-MR.nc"
> a = addfile (fili, "r")
> t=a->y
>
>  t at _FillValue  = -999.0
> t at missing_value = t at _FillValue
>
>  t = lonFlip(t)
> printVarSummary(t)
>
>  newlat=fspan(-89.50,89.50,180)   ;create a sequence for the new values
> of lat
> newlon=fspan(-179.5,179.5,360)   ;create a sequence for the new values of
> lon
>
>  newlat at units = "degrees_north"
> newlon at units = "degrees_east"
>
>  regrid= area_conserve_remap_Wrap(t&lon,t&lat,t,newlon,newlat,False)
> printVarSummary(regrid)
> print("regrid:  min="+min(regrid)+"  max="+max(regrid))
>
>  filo = "Regrid."+fili
> system("/bin/rm -f "+filo)
> fout=addfile(filo,"c")
> fout at creation_date = systemfunc("date")
> fout at title="Regrid_1*1 of "+fili
> fout->regrid=regrid
> end
>
>
>
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150217/7872ca38/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: regrid_and_plot.ncl
Type: application/octet-stream
Size: 3734 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150217/7872ca38/attachment.obj 


More information about the ncl-talk mailing list