[ncl-talk] Trouble with masking data for new file

Buzan, Jonathan jbuzan at purdue.edu
Fri Apr 16 09:05:18 MDT 2021


Hi NCL-Talk,

I have something conceptually wrong in my head with NCL.

I am attempting to take a .nc file with countries, and map them onto regions.

Country Map

[cid:F6B4FF24-54F1-4BBB-BEEC-CD5FBE6C06BD]


I use:

cntrycodes!0 = "lat"
cntrycodes&lat = lat
cntrycodes!1 = "lon"
cntrycodes&lon = lon
cntrycodes at long_name = "Country Codes"
cntrycodes at missing_value = cntrycodes at _FillValue
…


cntrycodes_region04 = where(cntrycodes.eq.7,4,cntrycodes_region04)
cntrycodes_region04 = where(cntrycodes.eq.10,4,cntrycodes_region04)
cntrycodes_region04 = where(cntrycodes.eq.13,4,cntrycodes_region04)
…
cntrycodes_region04 = where(cntrycodes.eq.145,4,cntrycodes_region04)
cntrycodes_region04 = where(cntrycodes.eq.152,4,cntrycodes_region04)


I get:
[cid:8479E216-2B25-4B77-909A-66B3FAF84C4C]

I do this for 16 regions.
Then I try to put it together:

cntrycodes_regionALL = where(cntrycodes_region01.eq.1,1,cntrycodes_regionALL)
cntrycodes_regionALL = where(cntrycodes_region02.eq.2,2,cntrycodes_regionALL)
cntrycodes_regionALL = where(cntrycodes_region03.eq.3,3,cntrycodes_regionALL)
…
cntrycodes_regionALL = where(cntrycodes_region15.eq.15,15,cntrycodes_regionALL)
cntrycodes_regionALL = where(cntrycodes_region16.eq.16,16,cntrycodes_regionALL)

And I get:
[cid:B7C3B8DC-019E-448E-A4B0-1CC12746C8BB]


I am not sure what I am doing wrong. But I have a feeling it is with how I am using the where function.

Cheers,
-Jonathan




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20210416/dc691637/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screen Shot 2021-04-16 at 4.26.06 PM.png
Type: image/png
Size: 37590 bytes
Desc: Screen Shot 2021-04-16 at 4.26.06 PM.png
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20210416/dc691637/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screen Shot 2021-04-16 at 5.02.56 PM.png
Type: image/png
Size: 17198 bytes
Desc: Screen Shot 2021-04-16 at 5.02.56 PM.png
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20210416/dc691637/attachment-0001.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screen Shot 2021-04-16 at 5.04.10 PM.png
Type: image/png
Size: 13174 bytes
Desc: Screen Shot 2021-04-16 at 5.04.10 PM.png
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20210416/dc691637/attachment-0002.png>


More information about the ncl-talk mailing list