[ncl-talk] Wrong values getting on contour plot

Barry Lynn barry.h.lynn at gmail.com
Thu Jun 4 11:15:24 MDT 2020


Hi Arathy:

Are you aware that you (most likely) subsetting one time step of the data?
Don't you need a time series?  I am not sure you are mapping the right
parameter (f) -- but that is another issue.

Instead of that, subset the data over lat/lon you want this way:

f=data->MSL_GDS0_SFC(:,:,:)(or leave out all (:,:,:).


Then,


use the min command to find the minimum pressure within the subsetted data
set.

https://www.ncl.ucar.edu/Document/Functions/Built-in/min.shtml

You can use:

https://www.ncl.ucar.edu/Document/Functions/Built-in/minind.shtml

to find the location of the minimum pressure within the data set.

but first use:

https://www.ncl.ucar.edu/Document/Functions/Built-in/onedtond.shtml

Just follow Example 2 or 3 on the minind page above.

(below)

*Example 2*

Find the index of the minimum value in a multi-dimensional array.

;---Create a dummy 2 x 2 x 4 array.
  a = (/(/(/1,2,3,4/), (/5,6,7,8/)/), (/(/9,1,9,8/),(/7,6,1,4/)/)/)

;---Convert to 1D
  a1D      = *ndtooned*
<https://www.ncl.ucar.edu/Document/Functions/Built-in/ndtooned.shtml>(a)
  dsizes_a = *dimsizes*
<https://www.ncl.ucar.edu/Document/Functions/Built-in/dimsizes.shtml>(a)

;---Resolve the 1D indices back to their original 3D array.
  indices  = *ind_resolve*
<https://www.ncl.ucar.edu/Document/Functions/Built-in/ind_resolve.shtml>(*minind*(a1D),dsizes_a)
  *print* <https://www.ncl.ucar.edu/Document/Functions/Built-in/print.shtml>(indices)

*Example 3*

Find the latitude and longitude location of the minimum value in a two
dimensional array.

;---X is a two dimensional array dimensioned lat x lon
  dims = *dimsizes*
<https://www.ncl.ucar.edu/Document/Functions/Built-in/dimsizes.shtml>(X)
  x1d = *ndtooned*
<https://www.ncl.ucar.edu/Document/Functions/Built-in/ndtooned.shtml>(X)
     ; convert 2D array to 1D for use in minind
  inds = *ind_resolve*
<https://www.ncl.ucar.edu/Document/Functions/Built-in/ind_resolve.shtml>(*minind*
(x1d), dims)    ; convert 1D array back to 2D
  ilat = inds(0,0)        ; select the latitude index where the X
array is at its' minimum
  ilon = inds(0,1)        ; select the longitude index where the X
array is at its' minimum
  lat_min = X&lat(ilat)   ; insert the latitude index into the lat
coordinate variable
  lon_min = X&lon(ilon)   ; insert the longitude index into the lon
coordinate variable
  *print* <https://www.ncl.ucar.edu/Document/Functions/Built-in/print.shtml>("Minimum
value located at "+lat_min+", "+lon_min)


to convert to a 1 dimensional array for the minind above.





On Thu, Jun 4, 2020 at 6:17 PM Arathy RP <arathyrparathy at gmail.com> wrote:

> Hi,
> Yes, your guess is correct .
> For getting minimum value I use the command
> printMinMax (f_sub,0).
> And f_sub is the subset of variable f . Variable f defines MSLP.
> I think if possible can you give a look at the whole code for convinence.
> I hereby attach the code .
>
>
>
> On Thu, Jun 4, 2020, 7:21 PM Barry Lynn <barry.h.lynn at gmail.com> wrote:
>
>> Hi:
>>
>> That doesn't look light the minimum.  What does the 32 indicate?
>>
>> I don't see your whole code in the email chain, although I thought it was
>> present.
>>
>> the variable f is the data MSL... at time 32 is my guess.
>>
>> You can do printVarSummary(f), to see the indices.
>>
>> I am not sure what f_sub is.  Is it supposed to be a subset of f?
>>
>> Can you just paste in the part where you think you are calculating the
>> minimum pressure, please.
>>
>> Barry
>>
>> Barry
>>
>>
>>
>> On Thu, Jun 4, 2020 at 3:18 PM Arathy RP <arathyrparathy at gmail.com>
>> wrote:
>>
>>> Hi,
>>> f=data->MSL_GDS0_SFC(32,:,:)
>>> And this part gives the minimum value of mean sea level pressure
>>> printMinMax(f_sub,0)
>>>
>>> On Thu, Jun 4, 2020, 1:44 PM Barry Lynn <barry.h.lynn at gmail.com> wrote:
>>>
>>>> Which part gives you the mslp?
>>>>
>>>> On Thu, 4 Jun 2020 at 10:16 Arathy RP <arathyrparathy at gmail.com> wrote:
>>>>
>>>>> Hi,
>>>>> Actually there is no error showing while running ncl code so i am not
>>>>> able to find which part of code is not working.
>>>>>
>>>>> On Thu, Jun 4, 2020, 12:36 PM Barry Lynn <barry.h.lynn at gmail.com>
>>>>> wrote:
>>>>>
>>>>>> Thank you for clarifying.
>>>>>>
>>>>>> I’d forgotten that strange way of referring to the level of the sea.
>>>>>>
>>>>>> Send me the part of the code you think is not working and I should be
>>>>>> able to help in a few hours.
>>>>>>
>>>>>> Barry
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Thu, 4 Jun 2020 at 9:55 Arathy RP <arathyrparathy at gmail.com>
>>>>>> wrote:
>>>>>>
>>>>>>> Hi,
>>>>>>> Actually mean sea level pressure doesn't make a sense of average of
>>>>>>> pressure , it simply meant the pressure of mean sea level and not related
>>>>>>> to averaging.
>>>>>>>
>>>>>>> On Thu, Jun 4, 2020, 12:04 PM Barry Lynn <barry.h.lynn at gmail.com>
>>>>>>> wrote:
>>>>>>>
>>>>>>>> Hi:
>>>>>>>>
>>>>>>>> You need to reply to all, or they will get lost.
>>>>>>>>
>>>>>>>> What do you imply by "mean sea level pressure?"  Do you imply that
>>>>>>>> the pressure is averaged?
>>>>>>>>
>>>>>>>> It is not hard to find the minimum in an data field, so please just
>>>>>>>> clarify and I will try to help you.
>>>>>>>>
>>>>>>>> It is hard for me to correct other people's code, but I can send
>>>>>>>> you code that should work to identify the minimum sea level pressure, or at
>>>>>>>> least help you to adapt your own.
>>>>>>>>
>>>>>>>> Barry
>>>>>>>>
>>>>>>>> On Thu, Jun 4, 2020 at 9:20 AM Arathy RP <arathyrparathy at gmail.com>
>>>>>>>> wrote:
>>>>>>>>
>>>>>>>>> Hi,
>>>>>>>>> Actually i want to get the minimum value for mean sea level
>>>>>>>>> pressure and I didn't understand the purpose for defining area .
>>>>>>>>> Can you please show an example.
>>>>>>>>>
>>>>>>>>> On Thu, Jun 4, 2020, 12:45 AM Barry Lynn <barry.h.lynn at gmail.com>
>>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>>> Hi:
>>>>>>>>>>
>>>>>>>>>> If you are plotting mean sea level pressure, you need to define
>>>>>>>>>> over what area you calculate the mean. Otherwise, your mean will encompass
>>>>>>>>>> an area much larger than the storm's center.
>>>>>>>>>>
>>>>>>>>>> For instance, you could calculate the mean in areas where the
>>>>>>>>>> wind speed is greater than some value, using the "where" statement.
>>>>>>>>>>
>>>>>>>>>> Do you do that?
>>>>>>>>>>
>>>>>>>>>> Barry
>>>>>>>>>>
>>>>>>>>>> On Wed, Jun 3, 2020 at 9:50 PM Arathy RP <
>>>>>>>>>> arathyrparathy at gmail.com> wrote:
>>>>>>>>>>
>>>>>>>>>>> Hi,
>>>>>>>>>>> Yes, I will do that.
>>>>>>>>>>> Actually I am plotting mean sea level pressure of very severe
>>>>>>>>>>> cyclonic storm Phailin.And I want to get the minimum mean sea level
>>>>>>>>>>> pressure as 994.29Pa only. As the cyclone belongs to category 5 storm the
>>>>>>>>>>> pressure level should go beyond 960Pa so that intensified contour plot of
>>>>>>>>>>> Phailin i will get. And the code is written by me by refering ncl sites.
>>>>>>>>>>> I hereby attach the variable details and minimum pressure
>>>>>>>>>>> showing when plotted.
>>>>>>>>>>> Thanking you
>>>>>>>>>>>
>>>>>>>>>>> On Wed, Jun 3, 2020 at 8:31 PM Barry Lynn <
>>>>>>>>>>> barry.h.lynn at gmail.com> wrote:
>>>>>>>>>>>
>>>>>>>>>>>> Hi:
>>>>>>>>>>>>
>>>>>>>>>>>> Can you show us what you are getting and what pressure you
>>>>>>>>>>>> print out as the center pressure.  This would help identify the problem.
>>>>>>>>>>>>
>>>>>>>>>>>> Also, where did you get the code to make the surface pressure
>>>>>>>>>>>> maps/tracking? Can you define what you mean by minimum contour plot.
>>>>>>>>>>>>
>>>>>>>>>>>> Barry
>>>>>>>>>>>>
>>>>>>>>>>>> On Wed, Jun 3, 2020 at 4:27 PM Arathy RP via ncl-talk <
>>>>>>>>>>>> ncl-talk at ucar.edu> wrote:
>>>>>>>>>>>>
>>>>>>>>>>>>> Hi,
>>>>>>>>>>>>> I am arz student of MSc finally year . As a part of my project
>>>>>>>>>>>>> work , i am working with cyclone contour plotting.I am dealing with cyclone
>>>>>>>>>>>>> phailin and i want to get minimum value contour plot for mean sea level
>>>>>>>>>>>>> pressure of cyclone.Actually there is no error showing even though i am
>>>>>>>>>>>>> getting a wrong value. I can't find what wrong with this .can you please
>>>>>>>>>>>>> help me to clarify it.
>>>>>>>>>>>>> I am dealing with an intensified cyclone plot but not getting
>>>>>>>>>>>>> a result as expected. Please help me.
>>>>>>>>>>>>> I hereby attaching the data and ncl script used.
>>>>>>>>>>>>> _______________________________________________
>>>>>>>>>>>>> ncl-talk mailing list
>>>>>>>>>>>>> ncl-talk at ucar.edu
>>>>>>>>>>>>> List instructions, subscriber options, unsubscribe:
>>>>>>>>>>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> --
>>>>>>>>>>>> Barry H. Lynn, Ph.D
>>>>>>>>>>>> Senior Associate Scientist, Lecturer,
>>>>>>>>>>>> The Institute of the Earth Science,
>>>>>>>>>>>> The Hebrew University of Jerusalem,
>>>>>>>>>>>> Givat Ram, Jerusalem 91904, Israel
>>>>>>>>>>>> Tel: 972 547 231 170
>>>>>>>>>>>> Fax: (972)-25662581
>>>>>>>>>>>>
>>>>>>>>>>>> C.E.O, Weather It Is, LTD
>>>>>>>>>>>> Weather and Climate Focus
>>>>>>>>>>>> http://weather-it-is.com
>>>>>>>>>>>> Jerusalem, Israel
>>>>>>>>>>>> Local: 02 930 9525
>>>>>>>>>>>> Cell: 054 7 231 170
>>>>>>>>>>>> Int-IS: x972 2 930 9525
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>> Barry H. Lynn, Ph.D
>>>>>>>>>> Senior Associate Scientist, Lecturer,
>>>>>>>>>> The Institute of the Earth Science,
>>>>>>>>>> The Hebrew University of Jerusalem,
>>>>>>>>>> Givat Ram, Jerusalem 91904, Israel
>>>>>>>>>> Tel: 972 547 231 170
>>>>>>>>>> Fax: (972)-25662581
>>>>>>>>>>
>>>>>>>>>> C.E.O, Weather It Is, LTD
>>>>>>>>>> Weather and Climate Focus
>>>>>>>>>> http://weather-it-is.com
>>>>>>>>>> Jerusalem, Israel
>>>>>>>>>> Local: 02 930 9525
>>>>>>>>>> Cell: 054 7 231 170
>>>>>>>>>> Int-IS: x972 2 930 9525
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> Barry H. Lynn, Ph.D
>>>>>>>> Senior Associate Scientist, Lecturer,
>>>>>>>> The Institute of the Earth Science,
>>>>>>>> The Hebrew University of Jerusalem,
>>>>>>>> Givat Ram, Jerusalem 91904, Israel
>>>>>>>> Tel: 972 547 231 170
>>>>>>>> Fax: (972)-25662581
>>>>>>>>
>>>>>>>> C.E.O, Weather It Is, LTD
>>>>>>>> Weather and Climate Focus
>>>>>>>> http://weather-it-is.com
>>>>>>>> Jerusalem, Israel
>>>>>>>> Local: 02 930 9525
>>>>>>>> Cell: 054 7 231 170
>>>>>>>> Int-IS: x972 2 930 9525
>>>>>>>>
>>>>>>>> --
>>>>>> Barry H. Lynn, Ph.D
>>>>>> Senior Associate Scientist, Lecturer,
>>>>>> The Institute of the Earth Science,
>>>>>> The Hebrew University of Jerusalem,
>>>>>> Givat Ram, Jerusalem 91904, Israel
>>>>>> Tel: 972 547 231 170
>>>>>> Fax: (972)-25662581
>>>>>>
>>>>>> C.E.O, Weather It Is, LTD
>>>>>> Weather and Climate Focus
>>>>>> http://weather-it-is.com
>>>>>> Jerusalem, Israel
>>>>>> Local: 02 930 9525
>>>>>> Cell: 054 7 231 170
>>>>>> Int-IS: x972 2 930 9525
>>>>>>
>>>>>> --
>>>> Barry H. Lynn, Ph.D
>>>> Senior Associate Scientist, Lecturer,
>>>> The Institute of the Earth Science,
>>>> The Hebrew University of Jerusalem,
>>>> Givat Ram, Jerusalem 91904, Israel
>>>> Tel: 972 547 231 170
>>>> Fax: (972)-25662581
>>>>
>>>> C.E.O, Weather It Is, LTD
>>>> Weather and Climate Focus
>>>> http://weather-it-is.com
>>>> Jerusalem, Israel
>>>> Local: 02 930 9525
>>>> Cell: 054 7 231 170
>>>> Int-IS: x972 2 930 9525
>>>>
>>>>
>>
>> --
>> Barry H. Lynn, Ph.D
>> Senior Associate Scientist, Lecturer,
>> The Institute of the Earth Science,
>> The Hebrew University of Jerusalem,
>> Givat Ram, Jerusalem 91904, Israel
>> Tel: 972 547 231 170
>> Fax: (972)-25662581
>>
>> C.E.O, Weather It Is, LTD
>> Weather and Climate Focus
>> http://weather-it-is.com
>> Jerusalem, Israel
>> Local: 02 930 9525
>> Cell: 054 7 231 170
>> Int-IS: x972 2 930 9525
>>
>>

-- 
Barry H. Lynn, Ph.D
Senior Associate Scientist, Lecturer,
The Institute of the Earth Science,
The Hebrew University of Jerusalem,
Givat Ram, Jerusalem 91904, Israel
Tel: 972 547 231 170
Fax: (972)-25662581

C.E.O, Weather It Is, LTD
Weather and Climate Focus
http://weather-it-is.com
Jerusalem, Israel
Local: 02 930 9525
Cell: 054 7 231 170
Int-IS: x972 2 930 9525
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20200604/aa5a9de3/attachment.html>


More information about the ncl-talk mailing list