[ncl-talk] sub: regrid error...

Meina Wang mnawang at ucdavis.edu
Fri Sep 15 18:01:01 MDT 2017


Hi Dale,

>From your script " lat2d = iz->lat lon2d = iz->lon", it looks like to me
the lat lon variables are 2D, and the linint2 function only works on 1D lat
lon, therefore you got the error saying they are not monotonically
increasing.  Is the grid curvelinear?  If so, you could check
rcm2rgrid function
which works on curvelinear lat lon (2D).

Best,
Meina

On Fri, Sep 15, 2017 at 4:15 PM, dale zuri <dalezuri at gmail.com> wrote:

> Hi
> I need help to regrid irregular two dimensional grid to regular. Could
> someone help me to fix this issue?
> I am getting this warning message
>
> warning:linint2: xi, yi, xo, and yo must be monotonically increasing
> I would appreciate any help and suggestions.
>
> Thanks
>
> begin
> yr="2015"
> ;******************************************************
> ;;;;CFS begins;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> a1    = addfile("/import/c1/NCARCCM/h/marchforecast/psa_mask_cfsv2.nc
> ","r")
> ;print(a1)
> mas1=a1->mask
>
> ;;;;;;;;;;;;0----LAnd only--1-20 PSA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> mas1=where(mas1.ge.2,1,mas1 at _FillValue)
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> f1    = addfile("/import/c1/NCARCCM/h/marchforecast/mar1982-2010/sim
> pleWunit.2005031212.nc", "r")   ; note the "s" of addfile
> T1    = f1->precSum                ; read T from all files
> printVarSummary (T1)
> latnew=f1->lat_0
> lonnew=f1->lon_0
> ;---Mask the "ts" variable across all time steps and copy metadata.
>  T_mask1 = mask(T1,mas1,1)
>  copy_VarMeta(T1,T_mask1)
> printVarSummary(T_mask1)
> zAvgTime1=T_mask1
> printVarSummary(zAvgTime1)
> ;****************************************************
> ;;;;;;ERA BEGINS;;;;;;;;;;;;;;;;;;
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> a    = addfile("psa_wrf.nc","r")
> print(a)
> mas=a->mask
> printVarSummary(mas)
> printMinMax(mas,0)
> ;;;;;;;;;;;;0----LAnd only--1-20 PSA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> mas=where(mas.ge.2,1,mas at _FillValue)
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>   iz = addfile("landsea2_wrf.nc","r")
>   lat2d = iz->lat
>   lon2d = iz->lon
>  ;mas2=iz->mask
> ;;;;;;;;;;;;;;;;;;;;;;;;;;year selection;;;;;;;;;;;;;;;;;;;;;;;;;
>    diri = "/import/c1/NCARCCM/h/era/yearsnotuse/"   ; input directory
>    fils = systemfunc ("ls "+diri+"era-down_"+yr+"*.nc") ; file paths
>    f    = addfiles (fils, "r")   ; note the "s" of addfile
>    ListSetType (f, "cat")
>    T    = f[:]->p                ; read T from all files
>    printVarSummary (T)
>   T!1="lon2d"
>   T!2="lat2d"
>   T at lon2d = lon2d
>   T at lat2d = lat2d
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> ;---Mask the "ts" variable across all time steps and copy metadata.
>  T_mask = mask(T,mas,1)
>  copy_VarMeta(T,T_mask)
> printVarSummary(T_mask)
> zAvgTime=T_mask
> zAvgTime_FillValue = -999
> printVarSummary(zAvgTime)
> printVarSummary(zAvgTime(0,:,0))
> printVarSummary(lon2d)
> printVarSummary(lat2d)
> printMinMax(lon2d(0,:),0)
> printMinMax(lat2d(:,0),0)
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> ;;;;;;Interpolation Step;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> newsst = linint2(lon2d(:,0),lat2d(0,:),zAvgTime,True,lonnew,latnew,0)
> return
> end
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>


-- 
Meina Wang
PhD candidate in Atmospheric Science
Department of Land, Air and Water Resources
University of California, Davis
Davis, CA 95616
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170915/d3f5e35a/attachment.html>


More information about the ncl-talk mailing list