[ncl-talk] Problem with interpolation
Dennis Shea
shea at ucar.edu
Wed Jun 13 18:28:55 MDT 2018
The following documentation:
https://www.ncl.ucar.edu/Document/Functions/Built-in/int2p.shtml
https://www.ncl.ucar.edu/Document/Functions/Built-in/int2p_n.shtml
https://www.ncl.ucar.edu/Document/Functions/Contributed/int2p_n_Wrap.shtml
states that the '*pin*' argument "*values must be monotonically increasing
or decreasing*."
In your usage, 'pin' ==> 'theta' (potential temperature [PT])
pv2 = *int2p_n*(theta, pv, lvl, 1, 1)
NCL's function for potential vorticity [PV] on isobaric surfaces
https://www.ncl.ucar.edu/Document/Functions/Contributed/pot_vort_isobaric.
shtml
calculates and returns PV and PT. The PT calculation is pretty simple:
theta = t*(p0/p)^0.286
where 't' is the temperature [K]; 'p' [hPa or Pa] is the isobaric level.
This uses the monthly mean 't' at each grid point.
*For a time average 'theta' (eg: monthly mean),one would expect a stable
atmosphere. Hence, PT would always be monotonically increasing. *
*Unfortunately, isobaric data includes the results of temperature values
which havebeen derived via extrapolation below the surface. *EG: If the
surface pressure [PSFC] is 902 hPa,
the temperatures at 925, 950 and 1000hPa are derived via some unknown
extrapolation method.
Also, how is the monthly mean 't' of the computed? Do they average the
(say) 4 times daily values
for a month?
A rule-of-thumb is that *extrapolation is always dangerous*!!!!!!!!
Be careful with usage. Just because there are numbers, does not means they
are the correct numbers.
This is demonstrated in your data because the PT at the lowest level(s)
may-or-may not be
monotonically increasing. Where it is not, 'int2p_n' return an _FillValue.
Hence,
the issue you have encountered.
Likely, there is some fix. I'll think about it.
Good Luck
On Sun, Jun 10, 2018 at 7:03 PM, 张 南水 <zhangnanshui at hotmail.com> wrote:
> Dear Sir,
>
> I have a problem to interpolate potential vorticity to isentropic
> levels. All the data is derived from NCEP-DOE Reanalysis 2. The potential
> vorticity is obtained via the function "pot_vort_isobaric", and so as to
> the potential temperature. And the interpolation is done by the function
> "int2p_n". However, plenty of undefined grids appear in the the potential
> vorticity field at an isentropic level, see 350K. And the undefined grids,
> which locate at the same position for all time, are not coherent with the topography.
> I have no idea that how does those undefined grids appear and how to deal
> with it? Thank you for your attention to this matter.
>
> The version of NCL I used is 6.4. And my system is Ubuntu 16.0 on windows
> 10. My script is as following and the image is attached.
>
> ;===========================================================
> ===============
>
> begin
>
> f1 = addfile("/mnt/e/NCEP/NCEP-R2/Daily/pv/pv.2010.nc","r")
>
> f2 = addfile("/mnt/e/NCEP/NCEP-R2/Daily/pt/pt.2010.nc","r")
>
>
>
> pv = f1->pv
>
> time = f1->time
>
> theta = f2->pt
>
>
> ; lvl = ispan(270,400,10)*1.
>
> lvl = (/ 300, 350, 400/) ; user specified
> inentropic levels
>
> lvl at description = "isentropic level" ; add meta data
>
> lvl at units = theta at units
>
> lvl!0 = "lvl"
>
> lvl&lvl = lvl
>
>
>
>
>
>
> ; pv2 = int2p(theta(time|:,lat|:,lon|:,level|:), \
>
> ; pv(time|:,lat|:,lon|:,level|:), lvl, 1)
>
> pv2 = int2p_n(theta, pv, lvl, 1, 1)
>
>
>
> pv2!0 = "time" ; name dimensions
>
> pv2!2 = "lat"
>
> pv2!3 = "lon"
>
> pv2!1 = "lvl"
>
> pv2&time = time ; assign coordinates
>
> pv2&lvl = lvl ; isentropic levels
>
> pv2&lat = pv&lat
>
> pv2&lon = pv&lon
>
> pv2 at long_name = pv at long_name ; attributes
>
> pv2 at units = pv at units
>
>
>
> ;------output
>
> fNameo = "/mnt/e/NCEP/NCEP-R2/Daily/pv_pt/pv.2010.nc"
>
> system("/bin/rm -f " + fNameo)
>
> fout = addfile(fNameo,"c")
>
> fout at title = " potential vorticity"
>
> fout at creation_date = systemfunc("date")
>
> filedimdef(fout,"time",-1,True)
>
> fout->pv = pv2
>
>
>
> end
>
>
>
> ;===========================================================
> ===============
>
>
>
>
>
> Yours,
>
> Nanshui
>
>
>
>
> _______________________________________________
> 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/20180613/08729924/attachment.html>
More information about the ncl-talk
mailing list