Re: linint2_Wrap and missing values

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Mon Jul 01 2013 - 11:29:54 MDT

Jiaxin,

Instead of linint2, you may want to look at ESMF regridding:

http://www.ncl.ucar.edu/Applications/ESMF.shtml

You can try the default "bilinear" method, which will probably give you the same results, or you can try the "patch" or "conserve" methods.

ESMF regridding allows you to input "mask" grids that tell it where your source and destination grids are missing.

I would start by looking at the very first example, "ESMF_regrid_1.ncl". This one goes to a 5x5 degree grid, but you can change to:

    Opt@DstGridType = "1deg"

and change this lat/lon box as appropriate:

    Opt@DstLLCorner = (/ -60.d, 0.d/)
    Opt@DstURCorner = (/ 60.d, 355.d/)

This tells ESMF to regrid to a box represented by (lat= -60, lon = 0) and (lat = 60, lon = 360). If you don't set the above two options, then the regridding will happen over the whole globe.

Of course, you will need to modify the other parts of the script that open the data file and pull off the variable you want to regrid:

;---Read data from input file containing source grid
    srcFileName = "sst.nc"
    sfile = addfile(srcFileName,"r")
    temp = sfile->TEMP(0,0,:,:)

Also, to change the interpolation method used, set the special "InterpMethod" option:

  Opt@InterMethod = "patch" ; "bilinear", "conserve"

Regarding your second question, I believe "ncdump" is just showing you the missing values as "----" rather than as actual numbers. There *are* numbers in those locations. To verify this, try using "ncl_filedump" insted of "ncdump".

--Mary

On Jun 30, 2013, at 9:55 PM, Jiaxin Zhang wrote:

> Dear NCL users,
>
> I have a couple of questions about the linint2_Wrap function and missing values.
>
> 1- I have used linint2_Wrap to perform spatial interpolation from 0.5x0.5 to 1x1. According to the NCL website “If missing values are present, then linint2_Wrap will perform the bilinear interpolation at all points possible, but will return missing values at coordinates which could not be used”. In my case, the original netcdf files at 0.5x0.5 contain temperature values only for land grids, but not for water grids. Does this mean that when I am using the linint2_Wrap function to interpolate temperature values from 0.5x0.5 to 1x1, I am going to get missing values for most of the grids in land-water boundaries? In other words, in case I have to interpolate 1 temperature value in a 1x1 grid from 4 0.5x0.5 grids, is it necessary to have values for all 4 initial 0.5x0.5 grids? Or maybe is it still possible to get an interpolated value even if only 1 of the 4 original 0.5x0.5 grid cells contains a temperature value and the rest contain missing values? I am asking this because I am very interested in having climate values for the land-water boundary zone after the spatial interpolation, and I do not know if it is possible to do this with the linint2_Wrap function or not (perhaps changing some of the options of this function?). I am attaching the ncl code that I used for the spatial interpolation in case someone can provide any advice. Can anyone please tell me what is the best solution to get interpolated temperature values for most of the land-water boundary zone (instead of empty values)?
>
> 2- I have also realised that after doing an ncdump my original file contains missing values in all the grids without temperature values (see pic “ncdump_initial.jpg”). However, after performing spatial interpolation and creating the new netcdf, when doing an ncdump this file seems to have empty values (instead of fill values) for all the grids without temperature values (see pic “ncdump_interpolated.jpg”). Can anyone please explain me why this happens? Is there a way to keep the missing values (instead of empty values) after the spatial interpolation with linint2_Wrap? What should I do to solve this problem? Do I need to modify something in the attached ncl code when using linint2_Wrap?
> Your help will be very appreciated.
> Thank you.
>
> Jiaxin Zhang
> <interpol.ncl><ncdump_initial.jpg><ncdump_interpolated.jpg>_______________________________________________
> 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 Jul 1 11:30:07 2013

This archive was generated by hypermail 2.1.8 : Mon Jul 01 2013 - 12:35:42 MDT