[ncl-talk] problem with cssgrid_Wrap
Mary Haley
haley at ucar.edu
Sun Jan 21 11:30:04 MST 2018
I was unable to reproduce the error message using cssgrid. I think this
routine may not be the best one to use for regridding random data to a
rectilinear grid.
I suggest looking at ESMF_regrid, which allows you to specify different
interpolation methods, or dsgrid2, which takes similar arguments as cssgrid.
One thing of note is that you have very few points, yet you are trying to
regrid them to a 60 x 70 grid. Also, you have some stray points that are
separated from a cluster of points in the southeast, which also makes
regridding tricky.
See the attached scripts, which use ESMF_regrid and dsgrid2, so you can
compare. I plotted the results so you can see what's going on with the
original points, compared to the original points.
For more ESMF regridding examples, go to:
http://www.ncl.ucar.edu/Applications/ESMF.shtml
I think the ESMF patch method might give the best results in this case, but
you'll need to decide for yourself.
--Mary
On Fri, Jan 19, 2018 at 8:07 AM, 黄倩倩 via ncl-talk <ncl-talk at ucar.edu> wrote:
> Hi,
> I have a problem when I try to use cssgrid_Wrap. Could you please help me
> solve it?
> Thank you.
>
> ----------Problem:---------------
> CSSGRID - error -121, coordinates 121 and M coincide for some M >
> 121 >= 1 (coordinate numbering starting at 1).
> Error number -121 returned from c_cssgridd
> fatal:cssgrid: Error number -121.
> fatal:["Execute.c":8578]:Execute: Error occurred at or near line 5137 in
> file $NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl
>
> fatal:["Execute.c":8578]:Execute: Error occurred at or near line 45 in
> file 4-ave_10m_plot.ncl
>
> --------ncl script---------
> ;draw isolines of annual mean air stagnation days
>
> 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"
>
> begin
>
> fname="/home/hqq/decouple/top10/USsounding/stat_
> dispersion/annual_mean_w10.txt"
> lines = asciiread(fname,-1,"string")
>
> xlat0=stringtofloat(str_get_field(lines(1:),2,","))
> xlon0=stringtofloat(str_get_field(lines(1:),3,","))
> xnum0=stringtofloat(str_get_field(lines(1:),5,","))
> xnum0 at _FillValue=-999.
>
> a = ind(.not.ismissing(xnum0))
> xlat = xlat0(a)
> xlon=xlon0(a)
> xnum=xnum0(a)
> delete(a)
>
>
> ilat=new(60,float)
> ilon=new(70,float)
> ilat=fspan(24.,50.,60)
> ilon=fspan(-125.,-66.,70)
>
> ilon!0 = "lon"
> ilon at long_name = "lon"
> ilon at units = "degrees_east"
> ilat!0 = "lat"
> ilat at long_name = "lat"
> ilat at units = "degrees_north"
>
> inter_num=cssgrid_Wrap(xlat,xlon,xnum,ilat,ilon)
> inter_num!0="lat"
> inter_num!1="lon"
> inter_num&lat=ilat
> inter_num&lon=ilon
>
> ----------annual_mean_w10.txt data-------
> stn, lat, lon, ele, mean_w10
> 722010, 24.555000, -81.751999, 1.200000, 4.537894
> 722011, 28.290001, -81.436996, 25.000000, 3.302681
> 722012, 28.950001, -81.967003, 27.100000, 2.288134
> 722014, 28.474001, -82.454002, 23.500000, 2.497054
> 722015, 24.583000, -81.682999, 1.800000, 4.192316
> 722016, 24.726000, -81.052002, 2.400000, 3.525501
> 722017, 28.062000, -81.753998, 44.500000, 3.171314
> 722020, 25.788000, -80.317001, 8.800000, 3.824239
> 722021, 28.014000, -82.345001, 6.700000, 1.680814
> 722022, 26.378000, -80.108002, 4.000000, 4.132401
> 722024, 25.907000, -80.279999, 3.100000, 3.905527
> 722025, 26.072001, -80.153999, 3.400000, 4.092026
> 722026, 25.483000, -80.383003, 1.500000, 3.033066
> 722029, 25.648001, -80.432999, 3.100000, 3.654286
> 722060, 30.495001, -81.694000, 7.900000, 2.995290
> 722061, 39.466999, -106.150002, 3680.199951, 6.043694
> 722062, 31.476999, -82.861000, 78.300003, 1.999084
> 722065, 30.233000, -81.667000, 6.100000, 3.490778
> 722066, 30.400000, -81.417000, 4.900000, 3.516346
> 722067, 30.219000, -81.875999, 24.700001, 2.496306
> 722068, 30.336000, -81.514999, 12.500000, 3.205291
> 722069, 30.400000, -86.472000, 6.700000, 3.017413
> 722080, 32.898998, -80.041000, 12.200000, 3.542918
> 722081, 39.417000, -77.383003, 92.400002, 2.066125
> 722082, 42.245998, -89.582001, 261.799988, 3.683097
>
>
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> 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/20180121/af6fba7c/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: random_to_rectilinear_esmf_patch.png
Type: image/png
Size: 78443 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180121/af6fba7c/attachment-0003.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dsgrid_script.ncl
Type: application/octet-stream
Size: 4242 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180121/af6fba7c/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: esmf_script.ncl
Type: application/octet-stream
Size: 4491 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180121/af6fba7c/attachment-0003.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: random_to_rectilinear_dsgrid.png
Type: image/png
Size: 75525 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180121/af6fba7c/attachment-0004.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: random_to_rectilinear_esmf_bilinear.png
Type: image/png
Size: 77866 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180121/af6fba7c/attachment-0005.png>
More information about the ncl-talk
mailing list