[ncl-talk] Getting the grid point values of certain values in a masked array
Ty Buckingham
ty.buckingham at manchester.ac.uk
Thu Sep 13 09:16:47 MDT 2018
Thanks for the help so far, Barry.
Does anyone else have any ideas on how to resolve this?
Thanks
Ty
________________________________
From: Barry Lynn [barry.h.lynn at gmail.com]
Sent: 13 September 2018 16:03
To: Ty Buckingham
Subject: Re: [ncl-talk] Getting the grid point values of certain values in a masked array
Ty:
Please (always) send to NCL-Talk. I need to go and I won't be able to respond right now.
On Thu, Sep 13, 2018 at 4:38 PM Ty Buckingham <ty.buckingham at manchester.ac.uk<mailto:ty.buckingham at manchester.ac.uk>> wrote:
This where statement:
avo_masked = where(avo_zoom.gt.0.006,1,avo_zoom at _FillValue)
Is working just fine. I've attached a snippet of what the output from this looks like (it's over 58,000 values so I haven't printed them all). What I'd like to do next is to disregard all of the co-ordinates equal to 9.96921e+36 and just keep the coordinates for the values that equal 1. For example, from the snippet I'd like the co-ordinates (387,37-39) and none of the others. This where statement:
avo_gridpts = where(avo_masked.eq.1,avo_masked,0)
Gives me the same result as the first where statement.
To try and explain it visually - I'm using vorticity (avo in the script) as a proxy for the location of a cold front in my data. I then want all of the coordinates for where avo is 1 so i can have a list of coordinates that refer to the location of my cold front.
Thanks
Ty
________________________________
From: Barry Lynn [barry.h.lynn at gmail.com<mailto:barry.h.lynn at gmail.com>]
Sent: 13 September 2018 14:21
To: Ty Buckingham
Cc: ncl-talk
Subject: Re: [ncl-talk] Getting the grid point values of certain values in a masked array
Hi:
But you haven't explained why the where statement is not working for.
Can you print out the values that go into the where statement and result from the where statement and send a sample.
On Thu, Sep 13, 2018 at 4:18 PM Ty Buckingham <ty.buckingham at manchester.ac.uk<mailto:ty.buckingham at manchester.ac.uk>> wrote:
I have the coordinates for all of the values - including both the masked and filled values.
What I want is to isolate all the coordinates where the value = 1 and save these coordinates as a 1D array and ignore all the coordinates where the value =/= 1.
Ty
________________________________
From: Barry Lynn [barry.h.lynn at gmail.com<mailto:barry.h.lynn at gmail.com>]
Sent: 13 September 2018 14:15
To: Ty Buckingham
Cc: ncl-talk
Subject: Re: [ncl-talk] Getting the grid point values of certain values in a masked array
Hi:
When you extract the data, you should check and see what the coordinates are.
If there are none, they can be added.
Barry
On Thu, Sep 13, 2018 at 3:18 PM Ty Buckingham <ty.buckingham at manchester.ac.uk<mailto:ty.buckingham at manchester.ac.uk>> wrote:
Yes, there's no problem with the data itself, I'm just not sure how to extract values that equal 1 into a new array so they keep their lat/lon values.
Thanks
Ty
________________________________
From: Barry Lynn [barry.h.lynn at gmail.com<mailto:barry.h.lynn at gmail.com>]
Sent: 13 September 2018 12:44
To: Ty Buckingham; ncl-talk
Subject: Re: [ncl-talk] Getting the grid point values of certain values in a masked array
Hi:
Have you tried using PrintMinMAX(Variable, False) to see the range of your data?
Barry
On Thu, Sep 13, 2018 at 1:53 PM Ty Buckingham <ty.buckingham at manchester.ac.uk<mailto:ty.buckingham at manchester.ac.uk>> wrote:
I'm not entirely sure of the syntax. If I try something like:
avo_masked = where(avo_zoom.gt.0.006,1,avo_zoom at _FillValue)
avo_gridpts = where(avo_masked.eq.1,avo_masked,0)
I still get all of the false values and their corresponding grid points, when I only want avo_gridpts to contain the values equal to 1 and their corresponding grid point values.
Thanks
Ty
________________________________
From: Barry Lynn [barry.h.lynn at gmail.com<mailto:barry.h.lynn at gmail.com>]
Sent: 13 September 2018 10:50
To: Ty Buckingham
Subject: Re: [ncl-talk] Getting the grid point values of certain values in a masked array
Hi:
There should be. If you want to find only those values, then set the middle part of your where statement equal to that.
However, unless the values are exact you might have a problem finding them. Then, you might multiply by 1000 and then include the integer function.
Barry
On Thu, Sep 13, 2018 at 12:46 PM Ty Buckingham <ty.buckingham at manchester.ac.uk<mailto:ty.buckingham at manchester.ac.uk>> wrote:
Hi Barry,
It is indeed. Is there anyway to extract the grid points of all the values equal to 0.006 and ignore the rest?
Thanks
Ty
________________________________________
From: Barry Lynn [barry.h.lynn at gmail.com<mailto:barry.h.lynn at gmail.com>]
Sent: 13 September 2018 06:00
To: Ty Buckingham
Cc: ncl-talk
Subject: Re: [ncl-talk] Getting the grid point values of certain values in a masked array
Hi:
The where statement:
avo_masked = where(avo_zoom.gt.0.006,0.006,avo_zoom at _FillValue)
will set every grid with a value of 0.006 or greater equal to 0.006.
Is that what you wanted to do?
Barry
On Thu, Sep 13, 2018 at 12:18 AM Ty Buckingham <ty.buckingham at manchester.ac.uk<mailto:ty.buckingham at manchester.ac.uk><mailto:ty.buckingham at manchester.ac.uk<mailto:ty.buckingham at manchester.ac.uk>>> wrote:
Hi all,
I have a masked array and wish to get the grid points (or lat/lons) of all of the values that are above a certain threshold. I've been messing around with 'where' and 'if' statements but can't quite get it.
I've attached my script.
Any help?
Thanks in advance!
Ty
_______________________________________________
ncl-talk mailing list
ncl-talk at ucar.edu<mailto:ncl-talk at ucar.edu><mailto:ncl-talk at ucar.edu<mailto: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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180913/7b848896/attachment.html>
More information about the ncl-talk
mailing list