[ncl-talk] interpolation to finer resolution

Mary Haley haley at ucar.edu
Tue Sep 26 09:03:20 MDT 2017


Hi Debasish,

The linint2 routine requires that your lat/lon arrays be monotonically
increasing. In the icecvr7 variable, the latitudes are decreasing:

Variable: icecvr7
Type: float
Total Size: 260640 bytes
            65160 values
Number of Dimensions: 2
Dimensions and sizes: [lat_0 | 181] x [lon_0 | 360]
Coordinates:
            lat_0: [-90..90]     <---------------------------------
            lon_0: [ 0..359]

I see that you went through some trouble to reverse the latitude array by
creating a new one, but the problem is that only the latitude array was
reversed, and not the lat dimension of the icecvr7 variable, which is also
required.

To reverse a dimension, you can simply use the ::-1 syntax:

     icecvr7 = e1->ICEC_P0_L1_GLL0(::-1,:) ; reverse the latitudes


This will have the effect of reversing both the latitude coordinate array,
*and* the leftmost dimension of icecvr7 at the same time.

When using linint2, you also need to create the output latitudes as
increasing as well:

     newlat = fspan(-89.75,89.75,360)

Your linint2 section will now look like this:

     icecvr7 = e1->ICEC_P0_L1_GLL0(::-1,:) ; reverse the latitudes


     newlat = fspan(-89.75,89.75,360)
     newlon = fspan(0.25, 359.75, 720)
     newlat at units = "degrees_north"
     newlon at units = "degrees_east"

     new_icecvr7 =
linint2(icecvr7&lon_0,icecvr7&lat_0,icecvr7,True,newlon,newlat,0)

If you need for new_icecv7 to be north-to-south in the latitude dimension,
then use ::-1 again. For plotting, however, it doesn't matter which
direction the latitudes are going:
new_icecvr7 = new_icecvr7(::-1,:)

The rest of the code should be fine and you should get the attached plot.

-Mary


On Tue, Sep 26, 2017 at 8:40 AM, Debasish Hazra <debasish.hazra5 at gmail.com>
wrote:

> Hi,
>
> I am trying to interpolate ice cover from 1 degree to 0.5 degree using "linint2",
> but the attached plot shows near empty field after interpolation. Do I need
> to use different interpolations for the data set. Attached is ncl plot and
> resulting figure. I have uploaded data file "ocnf2015040900.grb2" in ftp
> server. Any help.
>
> Thanks.
> Debasish
>
> _______________________________________________
> 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/20170926/1acf40ba/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: IceCfs_Test.png
Type: image/png
Size: 604399 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170926/1acf40ba/attachment-0001.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: icecfs_mod2.ncl
Type: application/octet-stream
Size: 4554 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170926/1acf40ba/attachment-0001.obj>


More information about the ncl-talk mailing list