[ncl-talk] esmf_regrid fails to regrid at some locations

Mary Haley haley at ucar.edu
Wed Mar 29 10:30:39 MDT 2017


Lijun,

It's hard to tell what the problem is without looking at both the source
and destination grids. I don't know what your original data looks like, or
where the grid points fall. It would be easier if you could provide me with
the two NetCDF files so I can run the script here.

What I usually do is plot both the original data and the regridded data on
separate plots, and then add the source grid and the destination grid as a
series of points so I can see more clearly where they overlap. Depending on
whether the data itself has missing values, this could also affect how it
is regridded.

You can use gsn_coordinates to plot markers at locations where your
original or regridded data is missing and/or non missing. This way you
don't need to do all the "ind" calls yourself. See the fourth thumbnail
image of example #7 here:

http://www.ncl.ucar.edu/Applications/plot_data_on_map.shtml#ex7


To use gsn_coordinates, replace this code:

  ; add polymarkers at missing value locations
  co_regrid2D = CO_regrid(10,0,:,:)
  indices     = ind_resolve(ind(ismissing(ndtooned(co_regrid2D))),
dimsizes(co_regrid2D))
  dims        = dimsizes(indices)
  npts        = dims(0)
  Lon_group   = new(npts,float)
  Lat_group   = new(npts,float)

  do n = 0,npts-1
    Lon_group(n) = lon2d_AIRS(indices(n,0),indices(n,1))
    Lat_group(n) = lat2d_AIRS(indices(n,0),indices(n,1))
  end do

  pmres                     = True
  pmres at gsMarkerColor       = "black"
  pmres at gsMarkerIndex       = 16
  pmres at gsMarkerSizeF       = 0.02

  gsn_polymarker(wks, plot, Lon_group, Lat_group, pmres)

with this code (UNTESTED):

  ; add polymarkers at missing value locations
  mkres = True
  mkres at gsMarkerIndex            = 16     ; filled dots
  mkres at gsMarkerSizeF            = 3      ; you may need to adjust this
  mkres at gsnCoordsNonMissingColor = "black"
  mkres at gsnCoordsMissingColor    = "red"
  gsn_coordinates(wks,plot,co_regrid(10,0,:,:),mkres)

Meanwhile, let me know if you can provide the data files. You can use our
ftp site:

http://www.ncl.ucar.edu/report_bug.shtml#HowToFTP

Thanks,

--Mary




On Mon, Mar 27, 2017 at 9:36 AM, Lijun Diao <ljdiao at gmail.com> wrote:

> Hi, NCL talk forum:
>
>
>
> I am using ESMF_regrid to regrid my modeled CO (dimentioned
> Lev(15)*Row(299)*Col(459)) to AIRS L2 swath locations (dimentioned 45*30).
> I attached my code test.ncl for the  regridding and plotting. I found some
> of the regridded output are missing values. Then I plotted those missing
> value locations (black dots in the attached figure). The red dashed box
> defines my model domain. I understand when the satellite swath is  out of
> the model domain, the regridded CO will be missing values since no model
> grids will correspond to those locations. But as you can see, some black
> dots are actually inside my model domain, especially the upper right ones,
> which are relatively far away from the edges of the model domain. In
> another words, the esmf regrid program can not regrid accurately for some
> of the swath locations that are inside the model domain. It doesn’t make
> sense to me. What is the reason?
>
>
>
> Thanks,
>
>
>
>
>
> --------------------------------------
>
> Lijun Diao
>
> University of Houston
>
>
>
> _______________________________________________
> 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/20170329/f6bdcbc8/attachment.html 


More information about the ncl-talk mailing list