[Thread Prev][Thread Next][Index]

Re: [ferret_users] Masking and set var/bad = 0



Hi Josh,

Zero is a bit problematic for use as a bad-value, especially when your data contains zeros.  Try it this way:

   LET no_strat = if stratified[l=1:12@sum] eq 0 then 1

You don't need an "else" here.  By default in an IF, if there is no else it's treated as "else missing".  As I've written that command, the default missing-value of -1.e34 will be used for missing-data. If you want to assign a particular missing-value, then you can do that right on the LET command.

   LET/bad=-9999 no_strat = if stratified[l=1:12@sum] eq 0 then 1

Also have a look in the documentation about the distinction between IF and IFV.    There can be valid values of 0 in data.   Here's a variable with one value that's 0 and another that's missing.

yes? let var = {6, 2, 0, 2, , 3}

yes? list IF var then 1
             VARIABLE : IF VAR THEN 1
             SUBSET   : 6 points (X)
 1   / 1:  1.000
 2   / 2:  1.000
 3   / 3:   ....
 4   / 4:  1.000
 5   / 5:   ....
 6   / 6:  1.000

yes? list IFV var then 1
             VARIABLE : IFV VAR THEN 1
             SUBSET   : 6 points (X)
 1   / 1:  1.000
 2   / 2:  1.000
 3   / 3:  1.000
 4   / 4:  1.000
 5   / 5:   ....
 6   / 6:  1.000

By the way, you shouldn't be able to X as a variable name. (Did Ferret really let you use that command? Or were you just simplifying for writing the question? A command with  LET X = should return an error, " **ERROR: command syntax: cannot define: X")   X is a reserved keyword , used to refer to the x coordinate of the grid, so it's best to use other variable names.



On 6/21/2019 8:40 AM, JoshAB1995@xxxxxxxxxxx wrote:

Good Afternoon,

 

I’m having an issue using the set var/bad = 0 dataset command. I’ve defined some new regions as the following, to indicate presence or absence of stratification:

 

let X = if stratified[l=1:12@sum] eq 0 then 1 else 0

let Y = if stratified[l=10:2@sum] eq 0 and stratified[l=3:9@sum] gt 0 and stratified[l=3:9@sum] le 3 then 1 else 0

 

So this creates a map of 1’s where the region matches what is described in the mask, and 0’s where it doesn’t.

 

So now I try to mask out all of the 0’s so that I can create shapefiles of the areas matching my description using:

 

Set var/bad = 0 X

Set var/bad = 0 Y

 

However, this seems to mask the entirety of my data and I get a screen telling me that no data is available.

 

Does anyone have any clues as to why this happens? Because I am lost for ideas, I think it might be to do with the fact that both of these ‘original’ datasets will have values of 0 (as seen in original definitions), and so it is masking the original dataset, does anyone know how I can make the mask apply only to my map of 1’s and 0’s?

 

Many thanks,

 

Josh

 

Sent from Mail for Windows 10

 

--
Ansley Manke
NOAA/PMEL Science Data Integration Group
7600 Sand Point Way NE
206-526-6246

[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce / NOAA / OAR / PMEL / Ferret

Privacy Policy | Disclaimer | Accessibility Statement