Re: natgrid returns negative values

From: Noel Aloysius <noel.aloysius_at_nyahnyahspammersnyahnyah>
Date: Mon Feb 11 2013 - 13:17:46 MST

Thanks Bill and Mary.

The interpolated values should not have negative values. I noticed that
negative values are returned where the input data has zeros.

As per Bill's suggestion, I included the nnsetp parameters as shown below,

  dim_db = dimsizes(sub_db)
  do ivar=0,dim_db(0) - 1
    do itim=0,dim_db(1) - 1
      P1 = (/ sub_db(ivar,itim,:) /)

      nnsetp("non - set interpolated values are NOT allowed to be
negative", 1)
      nnsetp("ext - extrapolation NOT allowed outside the convex hull", 0)
      hist_db(ivar,itim,:,:) = (/ natgrid(lat_subs,lon_subs,P1,lat,lon) /)

      delete(P1)
    end do
  end do

I do not see any negative values now and all the interpolated grid values
seem reasonable.

Noel Aloysius

On Mon, Feb 11, 2013 at 1:22 PM, William Daniel Scheftic <
scheftic@email.arizona.edu> wrote:

> Hi Noel,
>
> The default use of natgrid does allow for some interpolated values
> beyond the range of your data. You can set control parameters using
> nnsetp (http://www.ncl.ucar.edu/Document/Functions/Built-in/nnsetp.shtml)
>
> Here's the list of parameters to control:
> http://www.ncarg.ucar.edu//ngmath/natgrid/parameters.html
>
> Look at parameters:
> "non" for preventing negative values
> "ext" for preventing extrapolation in the exterior of the grid
>
> Take Care,
>
> Bill Scheftic
>
> On Mon, Feb 11, 2013 at 10:52 AM, Mary Haley <haley@ucar.edu> wrote:
> > Hi Noel,
> >
> > Are you saying you think the negative values are wrong, or do you just
> want to get rid of them somehow? What do the 0 values represent in your
> data? That is, are they real values, or do they represent missing values?
> >
> > Could you provide us with a script and data so we can take a look?
> >
> > http://www.ncl.ucar.edu/report_bug.shtml#HowToFTP
> >
> > --Mary
> >
> > On Feb 11, 2013, at 10:34 AM, Noel Aloysius wrote:
> >
> >> Hi NCL,
> >>
> >> I am using natgrid to interpolate from a randomly-spaced (1600 points)
> grid to a regular-spaced rectilinear grid (47 x 47 lat/lon). I notice there
> are several negative values within the domain where it should all be
> positive. I mask out the region outside of the model domain. And the input
> data has no missing values but zeros are present.
> >>
> >> Is there are way or any other way to avoid negative values during the
> interpolation?
> >>
> >> Thanks,
> >> Noel
> >>
> >> _______________________________________________
> >> ncl-talk mailing list
> >> List instructions, subscriber options, unsubscribe:
> >> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
> >
> > _______________________________________________
> > ncl-talk mailing list
> > List instructions, subscriber options, unsubscribe:
> > http://mailman.ucar.edu/mailman/listinfo/ncl-talk
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Feb 11 13:17:59 2013

This archive was generated by hypermail 2.1.8 : Wed Feb 13 2013 - 09:25:58 MST