[ncl-talk] Removing line over ocean for soil moisture+ reversing color of plot
Adam Phillips
asphilli at ucar.edu
Thu May 26 15:52:22 MDT 2022
Hi Setareh,
So the problem turned out to be NaN values in the first timestep of your
plotted array (anom). NCL typically does not plot arrays with NaN's in a
graceful manner, and can return weird results without any kind of error
whatsoever. Strangely, setting cnFillMode = "RasterFill" sidestepped the
problem. But a better solution was to set all the NaN values to anom at _FillValue
using the replace_ieeenan
<https://www.ncl.ucar.edu/Document/Functions/Built-in/replace_ieeenan.shtml>
function. I also adjusted your vpWidth/Height settings to be within a valid
range (from 0->1) and adjusted your font sizes a bit. I have attached the
script and resulting plot.
Adam
On Thu, May 26, 2022 at 2:15 PM Setareh Rahimi <setareh.rahimi at gmail.com>
wrote:
> Dear Adam,
> So many thanks for your advice. Yes, I confirm that the plot I sent has
> been created by the attached script.
> I downloaded the data set from the link below:
> https://psl.noaa.gov/data/gridded/data.cpcsoil.html
> https://downloads.psl.noaa.gov/Datasets/cpcsoil/soilw.mon.mean.v2.nc
> "monthly mean"
> Best wishes,
>
> On Fri, May 27, 2022 at 12:13 AM Adam Phillips <asphilli at ucar.edu> wrote:
>
>> Hi Setareh,
>> Thanks for sending a short script and data file. Unfortunately the data
>> file (for me) is corrupted so I cannot run the script. Looking at your
>> script/plot though, I see that you are setting mpFillOn = False, but it
>> looks to me like the land in your plot is getting filled with gray (before
>> the color fill is applied).
>>
>> The reason I am asking this is that the weird contouring that you are
>> seeing over the ocean in the first panel is similar to an issue I have seen
>> when color filling an incomplete array when mpFIllOn is set to True. So
>> please verify that the script you sent creates the plot that you attached.
>>
>> If it does, please write out your anom array (which should be much
>> smaller than your original data file) and send it to ncl-talk.
>>
>> Something simple like this should work:
>> anom = calcMonAnomTLL(prc,prcClm)
>> v = addfile("anom.nc","c")
>> v->anom = anom
>>
>> Adam
>>
>>
>>
>> On Thu, May 26, 2022 at 9:55 AM Setareh Rahimi via ncl-talk <
>> ncl-talk at mailman.ucar.edu> wrote:
>>
>>> Dear Rick,
>>> Thank you for your advice. I got no errors or warnings regarding the
>>> script. I just wonder why there are values over the ocean!
>>> Best wishes,
>>>
>>> On Thu, May 26, 2022 at 8:17 PM Rick Brownrigg <brownrig at ucar.edu>
>>> wrote:
>>>
>>>> To your 1st question, were there any errors or warnings reported by NCL?
>>>>
>>>> On the 2nd question, it looks like you are setting your colors with
>>>> this line:
>>>>
>>>> res at cnFillPalette = "perc2_9lev"
>>>>
>>>> Perhaps try:
>>>>
>>>> cmap = read_colormap_file("perc2_9lev")
>>>> res at cnFillPalette = cmap(::-1, :)
>>>>
>>>> Take a look at the documentation for cnFillPalette for discussion on
>>>> how there might be two extra colors in the new palette; I don't know if
>>>> that matters to what you are trying to do:
>>>>
>>>>
>>>> http://ncl.ucar.edu/Document/Graphics/Resources/cn.shtml#cnFillPalette
>>>>
>>>> HTH...Rick
>>>>
>>>>
>>>> On Thu, May 26, 2022 at 8:47 AM Setareh Rahimi via ncl-talk <
>>>> ncl-talk at mailman.ucar.edu> wrote:
>>>>
>>>>>
>>>>> Dear all,
>>>>> I plotted the monthly anomaly of soil moisture, however, after
>>>>> plotting I noticed that for the month of January there are some lines
>>>>> over the Atlantic ocean. I wonder why this happened, please? The
>>>>> script, image,
>>>>> soilw.mon.mean.v2.nc
>>>>> <https://drive.google.com/file/d/1vl3N7Ptg0NnQGDBWOToGjj9CdcD9Fnr-/view?usp=drive_web>
>>>>> and the data set have been attached.
>>>>> I have another question. How can I reverse the color of the map,
>>>>> please?
>>>>> Please kindly advise me.
>>>>> Thanks in advance,
>>>>> Best wishes,
>>>>> --
>>>>> S.Rahimi
>>>>>
>>>>> _______________________________________________
>>>>> ncl-talk mailing list
>>>>> ncl-talk at mailman.ucar.edu
>>>>> List instructions, subscriber options, unsubscribe:
>>>>> https://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>>>
>>>>
>>>
>>> --
>>> S.Rahimi
>>>
>>> _______________________________________________
>>> ncl-talk mailing list
>>> ncl-talk at mailman.ucar.edu
>>> List instructions, subscriber options, unsubscribe:
>>> https://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>
>>
>>
>> --
>> Adam Phillips
>> Associate Scientist, Climate and Global Dynamics Laboratory, NCAR
>> www.cgd.ucar.edu/staff/asphilli/ 303-497-1726
>>
>> <http://www.cgd.ucar.edu/staff/asphilli>
>>
>
>
> --
> S.Rahimi
>
>
--
Adam Phillips
Associate Scientist, Climate and Global Dynamics Laboratory, NCAR
www.cgd.ucar.edu/staff/asphilli/ 303-497-1726
<http://www.cgd.ucar.edu/staff/asphilli>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20220526/8271cba1/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: soil-moist.png
Type: image/png
Size: 206537 bytes
Desc: not available
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20220526/8271cba1/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: soilmoisture
Type: application/octet-stream
Size: 6077 bytes
Desc: not available
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20220526/8271cba1/attachment.obj>
More information about the ncl-talk
mailing list