[ncl-talk] mask problem

Dennis Shea shea at ucar.edu
Wed Nov 7 12:55:13 MST 2018


I saw that you ftp'd the data file: *yearsum2000.nc <http://yearsum2000.nc>*

    double pre(time, *longitude, latitude*) ;
        pre:long_name = "precipitation" ;
        pre:units = "mm" ;
*        pre:_FillValue = NaN ;*            <==== *The problem*
*        pre:missing_value = NaN*

The issue is that there are no _FillValue in the .original variable. Hence,
the following *does not* *change *the _FillValue associated with the
TRMM_reorder variable. It is st ill NaN

if (*any*(*isnan_ieee*(TRMM_reorder))) then
      value = 1.e20
      *replace_ieeenan* (TRMM_reorder, value, 0)
      TRMM_reorder at _FillValue = value
end if

Later, *after the mask is applied* the masked values are set to _FillValue
which are still NaN. NCL graphics can not handle NaNs and the errors occur.
The solution is simple. Explicitly set

  value = 1d20
  TRMM_reorder at missing_value = value                  ; Force change to CF
recognized value
  TRMM_reorder at _FillValue    = value

This script also includes using the output from *stat_dispersion*
<http://www.ncl.ucar.edu/Document/Functions/Contributed/stat_dispersion.shtml>
to guide the setting of explicit contour levels.

See attached.




On Wed, Nov 7, 2018 at 12:20 AM Md. Jalal Uddin <dmjalal90 at gmail.com> wrote:

> Hi all,
>  I am getting the following errors. I went through the FAQ page, but the
> trick did not work (http://www.ncl.ucar.edu/FAQ/#err_msgs_013). What can
> I do to fix these?
>
> fatal:ContourPlotDraw: ARSCAM - ALGORITHM FAILURE
> fatal:ContourPlotDraw: draw error
> fatal:ContourPlotDraw: draw error
> fatal:PlotManagerDraw: error in plot draw
> fatal:_NhlPlotManagerDraw: Draw error
>
> On Wed, Nov 7, 2018 at 12:25 PM Dennis Shea <shea at ucar.edu> wrote:
>
>> *This is offline.*   *I do not want to have multiple emails. Please
>> think about what you are doin.*
>>
>> Did you carefully look at the script? Did you think about what it was
>> doing?
>>
>> I do not know where to start.
>>
>> [1]
>> Creating the netCDF file
>>
>> netCDF   = *True *  ; generate a netCDF file containing the mask
>>                              ; If *True*: save a netCDF for later use
>>                              ; if *False*: generate the mask locally; no
>> file created
>> You did not use/read the file I sent. That is fine. Change the above to
>>
>> netCDF   = *False *  ; generate the mask array; *False* means no netCDF
>> created
>>
>> [2] *WHY *did you comment the following? They are appropriate for the
>> mask.
>>
>>   ;res at cnLevelSelectionMode = "ExplicitLevels" ; explicitly set the
>> levels via cnLevels
>>   ;res at cnLevels         = (/1.,2.,3.,4./)      ; set the levels
>>   ;res at cnFillColors     = (/60,100,20,140,5/)  ; set the colors that
>> will be used to color fill
>>
>>    This is the source of your problem. *Uncomment these lines!!!*
>>    They have nothing to do with the precipitation data. Only the mask!
>>
>>
>> [3]* WHY did you comment the following;*
>>
>>   ;res2 at cnLevelSelectionMode = "ExplicitLevels"
>>   ;res2 at cnLevels         = (/0.1,1.0,1.5,2.0,2.5,5,7.5,10,15,20/) ; *"mm/day"
>> *
>>
>>   * and keep these?*
>>
>>    res2 at cnFillPalette    = (/"Snow","PaleTurquoise","PaleGreen" \
>>                            ,"SeaGreen3" ,"Yellow", "Orange","HotPink" \ ;
>> contour colors
>>                            ,"Red","Violet", "Purple", "Brown"  /)       ;
>> one more color than contour levels
>>
>>
>> *They go together!*
>>
>> You can comment:
>>
>>   ;res2 at cnFillPalette    = (/"Snow","PaleTurquoise","PaleGreen" \
>>   ;                       ,"SeaGreen3" ,"Yellow", "Orange","HotPink" \ ;
>> contour colors
>>   ;                       ,"Red","Violet", "Purple", "Brown"  /)       ;
>> one more color than contour levels
>>
>> You will get an evenly distributed contour plot. Most precipitation is
>> not well suited to even contour levels.
>>
>> ===
>> Also ...  your data are "sums"?????  If they are annual sums and you want
>> uneven contour levels then
>>
>>   res2 at cnLevelSelectionMode = "ExplicitLevels"
>>   res2 at cnLevels  = (/0.1,1.0,1.5,2.0,2.5,5,7.5,10,15,20/) ; *"mm/day" *
>>   *res2 at cnLevels  = 365*res2 at cnLevels    ; annual total*
>>   res2 at cnFillPalette    = (/"Snow","PaleTurquoise","PaleGreen" \
>>                            ,"SeaGreen3" ,"Yellow", "Orange","HotPink" \ ;
>> contour colors
>>                            ,"Red","Violet", "Purple", "Brown"  /)       ;
>> one more color than contour levels
>>
>> ====
>> If you have NaNs you must
>>
>>   if (*any* <http://www.ncl.ucar.edu/Document/Functions/Built-in/any.shtml>(*isnan_ieee*(x))) then
>>       value = 1.e20
>>       *replace_ieeenan* <http://www.ncl.ucar.edu/Document/Functions/Built-in/replace_ieeenan.shtml> (x, value, 0)
>>       x at _FillValue = value
>>   end if
>>
>>
>> On Tue, Nov 6, 2018 at 6:36 PM Md. Jalal Uddin <dmjalal90 at gmail.com>
>> wrote:
>>
>>> I am getting the following errors when I tried to plot.
>>>
>>> fatal:ContourPlotDraw: CPCLAM/AREDAM - UNABLE TO INSERT NODE INTO MAP
>>> fatal:ContourPlotDraw: draw error
>>> fatal:ContourPlotDraw: draw error
>>> fatal:PlotManagerDraw: error in plot draw
>>> fatal:_NhlPlotManagerDraw: Draw error
>>>
>>> I found the possible reason from the Internet that it might be the
>>> problem from 'nan' values. I tried to solve this problem in two ways (
>>> http://www.ncl.ucar.edu/Document/Functions/Built-in/isnan_ieee.shtml,
>>> http://www.ncl.ucar.edu/Document/Functions/Built-in/replace_ieeenan.shtml).
>>> They did not work. What can I do?
>>>
>>>
>>> On Mon, Nov 5, 2018 at 11:00 AM Dennis Shea <shea at ucar.edu> wrote:
>>>
>>>> [1] You could look on the WWW for a *file* containing a TRMM 0.25
>>>> degree land-sea mask. Did you try?
>>>>
>>>> [2] You could create your own mask. Did you look at the following?
>>>>             *http://www.ncl.ucar.edu/Applications/mask.shtml*
>>>> <http://www.ncl.ucar.edu/Applications/mask.shtml>
>>>>
>>>>     [a] Use shapefiles: Examples 12 & 13
>>>>     [b] The attached script uses NCL builtin *1-deg* landsea mask.
>>>> 3B42 is *0.25-deg.*
>>>> *         [ *See* mask_5.ncl ]. *It produces that attached netCDF file
>>>> and a sample plot.
>>>>
>>>> Do not respond to me. ncl-talk only
>>>>
>>>> On Sun, Nov 4, 2018 at 5:01 AM Md. Jalal Uddin <dmjalal90 at gmail.com>
>>>> wrote:
>>>>
>>>>> I understood your answer; however, I want to know more about it. Which
>>>>> data is only applicable for masking function in NCL? I am using TRMM 3B42
>>>>> data to mask precipitation over land. What should I do for TRMM data?
>>>>>
>>>>> On Sun, Nov 4, 2018 at 5:45 PM Karin Meier-Fleischer <
>>>>> meier-fleischer at dkrz.de> wrote:
>>>>>
>>>>>> Hi Jalal,
>>>>>>
>>>>>> NCL told you that the variable ORO is not in your file, so take a
>>>>>> look at your file and see what it contains. You can use ncl_filedump to do
>>>>>> it.
>>>>>>
>>>>>> -Karin
>>>>>>
>>>>>>
>>>>>> Am 04.11.2018 um 05:24 schrieb Md. Jalal Uddin <dmjalal90 at gmail.com>:
>>>>>>
>>>>>> Hi all,
>>>>>>
>>>>>>
>>>>>> I am getting the following error message when I tried to mask over
>>>>>> land.
>>>>>>
>>>>>>
>>>>>> fatal:["Execute.c":6394]:variable (ORO) is not in file (f)
>>>>>>
>>>>>>
>>>>>> ;;code
>>>>>>
>>>>>> f= addfile("yearsum2000.nc","r")
>>>>>>  pre = f->pre
>>>>>>  pre_reorder = pre(time|:,latitude|:,longitude|:)
>>>>>> ;printVarSummary(pre_reorder)
>>>>>>
>>>>>>
>>>>>> oro = f->ORO(0,:,:)   ;oro: orography data array (lat,lon). ; assumes
>>>>>> that lat and lon are attached to oro as coordinates,. ; and oro has values
>>>>>> ocean: 0, land: 1
>>>>>>
>>>>>>
>>>>>> ;;printVarSummary(pre)
>>>>>>
>>>>>> Variable: pre
>>>>>> Type: double
>>>>>> Total Size: 4608000 bytes
>>>>>>             576000 values
>>>>>> Number of Dimensions: 3
>>>>>> Dimensions and sizes:   [time | 1] x [longitude | 1440] x [latitude |
>>>>>> 400]
>>>>>> Coordinates:
>>>>>>             time: [911.75..911.75]
>>>>>>             longitude: [-179.875..179.875]
>>>>>>             latitude: [-49.875..49.875]
>>>>>> Number Of Attributes: 4
>>>>>>   long_name :     precipitation
>>>>>>   units :   mm
>>>>>>   _FillValue :    -nan
>>>>>>   missing_value : -nan
>>>>>>
>>>>>>
>>>>>> How can I solve this problem?
>>>>>>
>>>>>>
>>>>>> Best regards,
>>>>>>
>>>>>> Jalal
>>>>>> --
>>>>>> *Md. Jalal Uddin*
>>>>>> MSc in Applied Meteorology (English Language)
>>>>>> Nanjing University of Information, Science and Technology, China
>>>>>> B.Sc. in Disaster Management (Hons.)
>>>>>> Patuakhali Science and Technology University, Bangladesh.
>>>>>> Cell: +8613260859092, +8801792052662
>>>>>> Web: www.dmjalal90.weebly.com
>>>>>> Facebook: jalal.hossen.39
>>>>>> LinkedIn: https://bd.linkedin.com/in/md-jalal-uddin-80a026b0
>>>>>> Twitter: dmjalal90
>>>>>> Skype: dmjalal90
>>>>>>
>>>>>> _______________________________________________
>>>>>> ncl-talk mailing list
>>>>>> ncl-talk at ucar.edu
>>>>>> List instructions, subscriber options, unsubscribe:
>>>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>>>>
>>>>>>
>>>>>
>>>>> --
>>>>> *Md. Jalal Uddin*
>>>>> MSc in Applied Meteorology (English Language)
>>>>> Nanjing University of Information, Science and Technology, China
>>>>> B.Sc. in Disaster Management (Hons.)
>>>>> Patuakhali Science and Technology University, Bangladesh.
>>>>> Cell: +8613260859092, +8801792052662
>>>>> Web: www.dmjalal90.weebly.com
>>>>> Facebook: jalal.hossen.39
>>>>> LinkedIn: https://bd.linkedin.com/in/md-jalal-uddin-80a026b0
>>>>> Twitter: dmjalal90
>>>>> Skype: dmjalal90
>>>>> _______________________________________________
>>>>> ncl-talk mailing list
>>>>> ncl-talk at ucar.edu
>>>>> List instructions, subscriber options, unsubscribe:
>>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>>>
>>>>
>>>
>>> --
>>> *Md. Jalal Uddin*
>>> MSc in Applied Meteorology (English Language)
>>> Nanjing University of Information, Science and Technology, China
>>> B.Sc. in Disaster Management (Hons.)
>>> Patuakhali Science and Technology University, Bangladesh.
>>> Cell: +8613260859092, +8801792052662
>>> Web: www.dmjalal90.weebly.com
>>> Facebook: jalal.hossen.39
>>> LinkedIn: https://bd.linkedin.com/in/md-jalal-uddin-80a026b0
>>> Twitter: dmjalal90
>>> Skype: dmjalal90
>>> _______________________________________________
>>> ncl-talk mailing list
>>> ncl-talk at ucar.edu
>>> List instructions, subscriber options, unsubscribe:
>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>
>>
>
> --
> *Md. Jalal Uddin*
> MSc in Applied Meteorology (English Language)
> Nanjing University of Information, Science and Technology, China
> B.Sc. in Disaster Management (Hons.)
> Patuakhali Science and Technology University, Bangladesh.
> Cell: +8613260859092, +8801792052662
> Web: www.dmjalal90.weebly.com
> Facebook: jalal.hossen.39
> LinkedIn: https://bd.linkedin.com/in/md-jalal-uddin-80a026b0
> Twitter: dmjalal90
> Skype: dmjalal90
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20181107/eae61f40/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 3B42_year2000.png
Type: image/png
Size: 646133 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20181107/eae61f40/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 3B42_year2000.white.png
Type: image/png
Size: 618565 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20181107/eae61f40/attachment-0003.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TRMM_mask.ncl
Type: application/octet-stream
Size: 8286 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20181107/eae61f40/attachment-0001.obj>


More information about the ncl-talk mailing list