[ncl-talk] Missing values are regridded?

Yuqiang Zhang yuqiangzhang.thu at gmail.com
Tue Feb 17 14:47:04 MST 2015


Hi Lifen,

 

Try add this line at the beginning of the script:

load "$NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl"

 

 

Regards,

Yuqiang

 

From: ncl-talk-bounces at ucar.edu [mailto:ncl-talk-bounces at ucar.edu] On Behalf Of Jiang, Lifen
Sent: Tuesday, February 17, 2015 4:41 PM
To: Mary Haley
Cc: ncl-talk at ucar.edu
Subject: Re: [ncl-talk] Missing values are regridded?

 

Hi Mary, 

 

Thanks for creating the script, but it showed error message when I ran it:

 

fatal:Could not open ($NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl)

fatal:error at line 5 in file regrid.ncl

 

Do you have any idea about this?

 

Thanks again,

 

Lifen

 

  _____  

From: Mary Haley [haley at ucar.edu]
Sent: Tuesday, February 17, 2015 2:52 PM
To: Jiang, Lifen
Cc: ncl-talk at ucar.edu
Subject: Re: [ncl-talk] Missing values are regridded?

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/9537518a/attachment-0001.html 


More information about the ncl-talk mailing list