[ncl-talk] Question on ocean/inland water fill

Rick Brownrigg brownrig at ucar.edu
Wed Jul 13 13:02:16 MDT 2022


Oh, I see -- rgba_to_color_index() expects normalized values between 0..1:

res at mpOceanFillColor = rgba_to_color_index((/ 205./255. ,255./255.
,255./255., 0.8/))

This does not return a negative value.


On Wed, Jul 13, 2022 at 12:45 PM Andrew Kren - NOAA Federal <
andrew.kren at noaa.gov> wrote:

> That worked, but I set the last value to 0.8 opacity and it said
>
> fatal:_NhlCvtScalarToIndex:Value -16777471 is less than index min -1
>
>
> Alternatively, is there a way to make a contour where the lowest value is
> transparent? This would fix the transparency issue where it plots values
> less than 1 as white.
>
>
> Thanks so much for your help!
>
> On Wed, Jul 13, 2022 at 1:47 PM Rick Brownrigg <brownrig at ucar.edu> wrote:
>
>> Not sure why it thinks there's a string involved.
>>
>> Perhaps use the re-assignment operator  ":="
>>
>> Or, perhaps wrap the color in a call to rgba_to_color_index:
>>
>>      res at mpOceanFillColor = rgba_to_color_index((/205.,255.,255.,1.0/))
>> ; note the added opacity value
>>
>> HTH...
>> Rick
>>
>> On Wed, Jul 13, 2022 at 11:36 AM Andrew Kren - NOAA Federal <
>> andrew.kren at noaa.gov> wrote:
>>
>>> Hi Rick,
>>>
>>> I set the ocean color as this:
>>>
>>> res at mpOceanFillColor = (/205.,255.,255./)
>>>
>>>
>>> I got this error message:
>>>
>>> fatal:Mul: operation not supported on type (string)
>>>
>>>
>>> Thanks!
>>>
>>>
>>>
>>> On Wed, Jul 13, 2022 at 1:30 PM Rick Brownrigg <brownrig at ucar.edu>
>>> wrote:
>>>
>>>> Hi Andrew,
>>>>
>>>> How did you try to set the ocean color, and what was the error NCL gave?
>>>>
>>>> Rick
>>>>
>>>> On Wed, Jul 13, 2022 at 10:53 AM Andrew Kren - NOAA Federal via
>>>> ncl-talk <ncl-talk at mailman.ucar.edu> wrote:
>>>>
>>>>> Hi there,
>>>>>
>>>>> I have a random question. I am plotting surface smoke from the HRRR
>>>>> but decided to add color to the ocean and inland water. When I plotted data
>>>>> for Alaska, since the HRRR domain only extends so far, the "cyan" color I
>>>>> chose ends up becoming noticeable outside the plotted region. I believe the
>>>>> reason the color shade is off is because I set a fill opacity less than 1,
>>>>> which makes the ocean in the plotted region lighter. See plotted image of
>>>>> the discrepancy.
>>>>>
>>>>> My question is, is there a way to get these two to match up without
>>>>> having to change the fill opacity? Alternatively, I tried to set the ocean
>>>>> fill color to the RGB triplet of the lighter ocean from the contour fill,
>>>>> but NCL gave an error.
>>>>>
>>>>> Any feedback is appreciated! Thanks.
>>>>>
>>>>> --
>>>>>
>>>>> Andrew Kren
>>>>> Meteorologist
>>>>> NOAA's National Weather Service
>>>>> Raleigh Forecast Office
>>>>> 1005 Capability Drive, Suite 300
>>>>> Raleigh, North Carolina 27606
>>>>> voice: 919-326-1035
>>>>> mailto: andrew.kren at noaa.govhttp://www.weather.gov/rah
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> ncl-talk mailing list
>>>>> ncl-talk at mailman.ucar.edu
>>>>> List instructions, subscriber options, unsubscribe:
>>>>> https://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>>>
>>>>
>>>
>>> --
>>>
>>> Andrew Kren
>>> Meteorologist
>>> NOAA's National Weather Service
>>> Raleigh Forecast Office
>>> 1005 Capability Drive, Suite 300
>>> Raleigh, North Carolina 27606
>>> voice: 919-326-1035
>>> mailto: andrew.kren at noaa.govhttp://www.weather.gov/rah
>>>
>>>
>>>
>
> --
>
> Andrew Kren
> Meteorologist
> NOAA's National Weather Service
> Raleigh Forecast Office
> 1005 Capability Drive, Suite 300
> Raleigh, North Carolina 27606
> voice: 919-326-1035
> mailto: andrew.kren at noaa.govhttp://www.weather.gov/rah
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20220713/167294e5/attachment.htm>


More information about the ncl-talk mailing list