[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 07:18:37 MDT 2018


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]
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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180913/1daa7576/attachment.html>


More information about the ncl-talk mailing list