# Re: isosurface plot problem

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Tue Nov 22 2011 - 08:08:36 MST

I see what the issue is. The documentation for all the 'int2p*'
functions (eg)

function int2p_n (
pin : numeric,
xin : numeric,
pout : numeric,
linlog [1] : integer,
pdim [1] : integer
)
state that the 'pin' "values must be monotonically increasing or decreasing.

===
If 'pin' were 'depth' and 'xin' was 'modelTemp' then you would have
no problems. eg:
isot = int2p_n_Wrap(depth,modelTemp, tlev,0,1)
pin xin

However, when the arguments were reversed to 'trick' the function

isot = int2p_n_Wrap(modelTemp,depth tlev,0,1)
pin xin

The 'pin' )modelTemp) at some grid points were *not* monotonic.
Hence, the function detects this and returns all _FillValue.

Some examples:

A location where the function worked
depth T
0.00 25.76
20.00 25.75
40.00 22.71
60.00 20.95
80.00 19.62
100.00 18.43
150.00 15.80
[snip

the T which become 'pin' are monotonic

====
A place where it failed
depth T
0.00 26.88
20.00 26.91
40.00 26.91
60.00 26.90
80.00 25.75
100.00 23.88
150.00 19.63
[snip]
the T which become 'pin' are *not* monotonic

====
Another location where it failed
depth T
0.00 27.20
20.00 27.23
40.00 27.23
60.00 27.23
80.00 27.23
100.00 27.24
150.00 26.00
200.00 23.38
250.00 20.92
300.00 18.74
[snip]
the T which become 'pin' are *not* monotonic

So, punch line, the 'trick' of argument reversal did not work.
The function did what it says it will do if the 'pin' are not monotonic.

I'll try to think of a solution.

D

On 11/21/11 5:05 PM, Gerald Creager wrote:
> Uploaded tamu-ocean.nc to ftp.cgd.ucar.edu/incoming. Thanks, Dennis!
> Understand about no time.
>
> gerry
>
> On 11/21/2011 04:19 PM, Dennis Shea wrote:
>> Gerry, I just don't have a lot of time.
>> I saw that the file you pointed to is 3.7GB.
>> I am not going to download that file.
>> You should use the netCDF operators
>> (ncks or ncrcat to create a file with a few time steps)
>>
>> %> ncks -d time,0,3 in.nc out.nc
>>
>> D
>>
>>
>>
>> On 11/21/11 3:03 PM, Gerald Creager wrote:
>>> Dennis
>>>
>>> Changes made, but the plots continue to not show much. Here's the
>>> printVarSummary output:
>>>
>>> ncl 0> load "/root/NCL/createIsoTest.ncl"
>>> warning:int2p_n: 3267792 input array(s) contained all missing data. No
>>> interpolation performed on these arrays
>>> (0) ===
>>>
>>> Variable: modelTemp
>>> Type: float
>>> Total Size: 911806632 bytes
>>> 227951658 values
>>> Number of Dimensions: 4
>>> Dimensions and sizes: [time | 99] x [zlev | 22] x [latitude | 261] x
>>> [longitude | 401]
>>> Coordinates:
>>> time: [ 0..98]
>>> zlev: [ 0..3500]
>>> latitude: [18..31]
>>> longitude: [-98..-78]
>>> Number Of Attributes: 5
>>> name : sea_water_potential_temperature
>>> long_name : potential temperature
>>> units : deg C
>>> missing_value : -9999
>>> _FillValue : -9999
>>> (0) potential temperature: min=2.993 max=29.832
>>> (0) ===
>>>
>>> Variable: depth
>>> Type: float
>>> Total Size: 911806632 bytes
>>> 227951658 values
>>> Number of Dimensions: 4
>>> Dimensions and sizes: [time | 99] x [zlev | 22] x [latitude | 261] x
>>> [longitude | 401]
>>> Coordinates:
>>> time: [ 0..98]
>>> zlev: [ 0..3500]
>>> latitude: [18..31]
>>> longitude: [-98..-78]
>>> Number Of Attributes: 1
>>> units : m
>>> (0) min=0 max=3500
>>> (0) ===
>>>
>>> Variable: tlev
>>> Type: float
>>> Total Size: 4 bytes
>>> 1 values
>>> Number of Dimensions: 1
>>> Dimensions and sizes: [tlev | 1]
>>> Coordinates:
>>> Number Of Attributes: 1
>>> units : deg C
>>> (0) min=20 max=20
>>> (0) ===
>>>
>>> Resultant plots are in http://mesonet.tamu.edu/NCL
>>>
>>> Thanks, Gerry
>>>
>>> On 11/21/2011 02:58 PM, Dennis Shea wrote:
>>>> Gerry,
>>>>
>>>> It is best to send to ncl-talk.
>>>>
>>>> Your code looks good. After
>>>>
>>>> isot = int2p_n_Wrap(mmodelTempodelTemp, depth, tlev,0,1
>>>>
>>>> add the following to show that things [eg, units] are as u expect.
>>>>
>>>> print("===")
>>>> printVarSummary(modelTemp)
>>>> printMinMax(modelTemp,0)
>>>> print("===")
>>>> printVarSummary(depth)
>>>> printMinMax(depth,0)
>>>> print("===")
>>>> printVarSummary(tlev)
>>>> printMinMax(tlev,0)
>>>> print("===")
>>>>
>>>> Comment out
>>>>
>>>> cnRes@cnLevelSelectionMode = "ManualLevels" ; Manually define levels
>>>> cnRes@cnMinLevelValF = 40 ; Minimum depth (meters)
>>>> cnRes@cnMaxLevelValF = 150 ; Maximum depth (meters)
>>>> ;cnRes@cnLevelSpacingF = 5.
>>>>
>>>>
>>>> and let ncl choose the limits
>>>>
>>>> On 11/21/2011 10:16 AM, Gerald Creager wrote:
>>>>> Look at the pngs in http://mesonet.tamu.edu/NCL for an example of what
>>>>> I'm getting...
>>>>>
>>>>> gc
>>>>>
>>>>> On 11/19/2011 06:09 PM, Dennis Shea wrote:
>>>>>> The *_n functions were developed so that 'dimension reordering'
>>>>>> would not be necessary. For
>>>>>> modelTemp(time,zlev,latitude,longitude)
>>>>>> 0 1 2 3
>>>>>> The correct useage is
>>>>>>
>>>>>> isot = int2p_n_Wrap(modelTemp, depth, tlev, 0,1)
>>>>>>
>>>>>> D
>>>>>> On 11/19/11 1:13 PM, donna Cote wrote:
>>>>>>> Gerry, I'm know I'm guessing on what you are trying to do.
>>>>>>>
>>>>>>> I'm reading this (see quote or web page:
>>>>>>> http://www.ncl.ucar.edu/Document/Functions/Contributed/int2p_n_Wrap.shtml),
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> and I don't think "depth"'s right-most dimension is the level.
>>>>>>>
>>>>>>> "modelTemp" has the coordinates ordered as:
>>>>>>> [time | 99] x [zlev | 22] x [latitude | 261] x [longitude | 401]
>>>>>>>
>>>>>>> and this function wants (I think)
>>>>>>> [time | 99] x [latitude | 261] x [longitude | 401] x [zlev | 22]
>>>>>>>
>>>>>>> The same note applies to the depth and tlev vars.
>>>>>>>
>>>>>>> isot = int2p_n_Wrap(modelTemp, depth, tlev, 0,1)
>>>>>>> ^pin^ ^xin^ ^pout^
>>>>>>>
>>>>>>> It looks like you have to reorder the dimensions, which requires
>>>>>>> that
>>>>>>> all the dimensions be named. Ref:
>>>>>>> http://www.ncl.ucar.edu/Document/Language/reorder.shtml
>>>>>>>
>>>>>>> -Donna
>>>>>>>
>>>>>>> On 11/17/11 4:54 PM, Gerald Creager wrote:
>>>>>>>> Dennis, Mary,
>>>>>>>>
>>>>>>>> I've uploaded createIsoTest.ncl and an example PNG
>>>>>>> (Model1-20C.png) to
>>>>>>>> your incoming directory. My model .nc file was apparently too big
>>>>>>>> but
>>>>>>>> can be snagged from
>>>>>>>> http://mesonet.tamu.edu/iasnfs_forecast_2011111112_2012021712.nc
>>>>>>>>
>>>>>>>> I was expecting to see an isosurface over the whole Gulf of Mexico
>>>>>>>> region. This would be for the 20C isotherm, if I'm not completely
>>>>>>>> delusional.
>>>>>>>>
>>>>>>>> Any help or suggestions you could offer would be appreciated.
>>>>>>>>
>>>>>>>> Thanks, Gerry
>>>>>>>
>>>>>>>
>>>>>>> On 11/19/11 1:00 PM, ncl-talk-request@ucar.edu wrote:
>>>>>>>> Date: Fri, 18 Nov 2011 17:10:16 -0600
>>>>>>>> From: Gerald Creager<gerry.creager@tamu.edu>
>>>>>>>> Subject: Re: isosurface plot problem
>>>>>>>> To: Rick Brownrigg<brownrig@ucar.edu>
>>>>>>>> Cc:"ncl-talk@ucar.edu"<ncl-talk@ucar.edu>
>>>>>>>>
>>>>>>>> Howdy, Rick
>>>>>>>>
>>>>>>>> On 11/18/2011 04:42 PM, Rick Brownrigg wrote:
>>>>>>>>>> Hi Gerry,
>>>>>>>>>>
>>>>>>>>>> I don't have answers for you, but that is a most curious result.
>>>>>>>>>> The colors shown in the plot you attached aren't in the palette
>>>>>>>>>> you specified (gsn_define_colormap(wks,"BlAqGrYeOrRe") ). In
>>>>>>>>>> fact,
>>>>>>>>>> they are from the "default" palette, and appear to start with
>>>>>>>>>> index 4 (as per cnRes@gsnSpreadColorStart = 4), and are for the
>>>>>>>>>> most part every other color from the palette, with a few
>>>>>>>>>> exceptions. Its as though the palette is not getting set to what
>>>>>>>>>> you specified. Are you getting any errors/warnings about that?
>>>>>>>> No, I'm getting no errors on the pallete. I'm getting a warning on
>>>>>>>> int2p_n, but that's all.
>>>>>>>>
>>>>>>>>>> Also, please excuse my ignorance of the science, but the range of
>>>>>>>>>> depth intervals is from 40 to 150m; is it possible parts of the
>>>>>>>>>> 20C isotherm are at depths outside that range?
>>>>>>>> They shouldn't be, unless I've done something wrong. Depth should
>>>>>>>> be:
>>>>>>>> 0,
>>>>>>>> 20,40,60,80,100,150,200,250,300,400,500,700,800,900,1000,1500,2000,2500,3000,3500
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> or, 22 levels that are NOT evenly spaced. I anticipate the 20C
>>>>>>>> isotherm
>>>>>>>> would lie in the forst 4-6 levels but for really deep loop
>>>>>>>> currents, it
>>>>>>>> can be a bit deeper...
>>>>>>>>
>>>>>>>> Please help me out (I've stared at this 'til I'm cross-eyed): Where
>>>>>>>> am I
>>>>>>>> limiting the levels?
>>>>>>>>
>>>>>>>> gerry
>>>>>>>>
>>>>>>>>>> FWIW...
>>>>>>>>>> Rick
>>>>>>>>>>
>>>>>>>>>> On Nov 18, 2011, at 11:06 AM, Gerald Creager wrote:
>>>>>>>>>>
>>>>>>>>>>>> I've uploaded createIsoTest.ncl and an example PNG
>>>>>>>>>>>> (Model1-20C.png) to your incoming directory. My model .nc file
>>>>>>>>>>>> was apparently too big but can be snagged from
>>>>>>>>>>>> http://mesonet.tamu.edu/iasnfs_forecast_2011111112_2012021712.nc
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> I was expecting to see an isosurface over the whole Gulf of
>>>>>>>>>>>> Mexico region. This would be for the 20C isotherm, if I'm not
>>>>>>>>>>>> completely delusional.
>>>>>>>>>>>>
>>>>>>>>>>>> Any help or suggestions you could offer would be appreciated.
>>>>>>>>>>>>
>>>>>>>>>>>> Thanks, Gerry
>>>>>>> _______________________________________________
>>>>>>> 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 Tue Nov 22 08:08:47 2011

This archive was generated by hypermail 2.1.8 : Tue Nov 22 2011 - 14:17:52 MST