[ncl-talk] CvtStringGenArrayToColorIndexGenArray error

Joshua Lave lave at ucar.edu
Fri Nov 9 14:58:11 MST 2018


load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"

load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"

load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"


begin

; Input file

infile = "RA79.txt.counts.csv.ASOS"


; Read file

indata = asciiread(infile,-1,"string")


; Read in necessary data

values = tointeger(str_get_field(indata(1:),8,","))

values at lat1d = tofloat(str_get_field(indata(1:),3,","))

values at lon1d = tofloat(str_get_field(indata(1:),4,",")) * -1


; Open plot workspace, name future file

wks = gsn_open_wks("ps","RA79_contour")


; Resource list

res                             = True

res at gsnMaximize                 = True


; Contour levels

res at cnLevelSelectionMode        = "ManualLevels"

res at cnMinLevelValF              = 0

res at cnMaxLevelValF              = 10000

res at cnLevelSpacingF             = 100


; Contour lines, fill, and color

res at cnFillOn                    = True

res at cnLinesOn                   = False

res at cnFillPalette               = "MPL_gist_rainbow"

res at cnFillDrawOrder             = "PreDraw"


; Map and mesh definitions and resources

res at mpProjection                = "RotatedMercator"

res at trGridType                  = "TriangularMesh"


res at mpLimitMode                 = "Corners"

res at mpRightCornerLatF           = min(values at lat1d)-2

res at mpLeftCornerLonF            = min(values at lon1d)-2

res at mpLeftCornerLatF            = max(values at lat1d)+2

res at mpRightCornerLonF           = max(values at lon1d)+2


res at mpFillOn                    = True

res at mpFillAreaSpecifiers        = (/"Land", "US", "Water"/)

res at mpSpecifiedFillColors       = (/"white", "transparent", "blue"/)

res at pmTickMarkDisplayMode       = "Always"   ; nicer map tickmarks

; res at mpFillColors                = False


res at cnFillMode   = "AreaFill"    ; "AreaFill" is the default

res at tiMainString = "Number of Hourly METAR Reports of Rain at Future ASOS
Sites, 1979-1988 (smooth contours)"


plot = gsn_csm_contour_map(wks,values,res)


end

On Fri, Nov 9, 2018 at 11:46 AM Adam Phillips <asphilli at ucar.edu> wrote:

> Hi Joshua,
> I am not getting the error message when using your resource list (minus
> the map limit selections). This is odd. Can you try eliminating most of the
> resources, and see if the error message disappears? If so, then start
> adding resources back one or two at a time until you find the offending
> resource. If the debugging doesn't work, then (assuming you're running on
> cheyenne) offline send me the location of your script so I can take a look.
> Adam
>
> On Fri, Nov 9, 2018 at 11:11 AM Joshua Lave <lave at ucar.edu> wrote:
>
>> Here is my resource list.
>>
>>
>> res                             = True
>>
>> res at gsnMaximize                 = True
>>
>>
>> res at cnLevelSelectionMode        = "ManualLevels"
>>
>> res at cnMinLevelValF              = 0
>>
>> res at cnMaxLevelValF              = 10000
>>
>> res at cnLevelSpacingF             = 100
>>
>>
>> res at cnFillOn                    = True
>>
>> res at cnLinesOn                   = False
>>
>>
>> res at lbBoxLinesOn                = False
>>
>>
>> res at mpProjection                = "RotatedMercator"
>>
>>
>> res at mpLimitMode                 = "Corners"
>>
>> res at mpRightCornerLatF           = min(values at lat1d)-2  ; Pulled from the
>> datafile
>>
>> res at mpLeftCornerLonF            = min(values at lon1d)-2
>>
>> res at mpLeftCornerLatF            = max(values at lat1d)+2
>>
>> res at mpRightCornerLonF           = max(values at lon1d)+2
>>
>>
>> res at mpFillOn                    = False
>>
>> res at pmTickMarkDisplayMode       = "Always"
>>
>> res at cnFillMode                  = "AreaFill"
>>
>>
>> plot = gsn_csm_contour_map(wks,values,res)
>>
>>
>>
>> On Fri, Nov 9, 2018 at 10:51 AM Adam Phillips <asphilli at ucar.edu> wrote:
>>
>>> Hi Joshua,
>>> ncl-talk is the correct place for this question. I ran a script with the
>>> following resources in v6.3.0, 6.4.0 and 6.5.0 and I didn't receive an
>>> error message:
>>>   res           = True
>>>   res at mpFillOn = True   ; turn on the map filling resource
>>>   res at mpFillColors = (/
>>> "transparent","transparent","LightGray","transparent"/)   ; color the
>>> continents gray
>>>   res at mpMinLatF = -70.   ; set the minimum latitude = -70.
>>>   res at mpMaxLatF = 70.   ; set the maximum latitude = 70.
>>>
>>>   res at cnLevelSelectionMode = "ManualLevels" ; manually set the contour
>>> levels with the following 3 resources
>>>   res at cnMinLevelValF  = -5. ; set the minimum contour level
>>>   res at cnMaxLevelValF  = 30. ; set the maximum contour level
>>>   res at cnLevelSpacingF = 5. ; set the interval between contours
>>>   plot = gsn_csm_contour_map(wks,x,res)
>>>
>>> Can you send to ncl-talk your complete resource list?
>>> Adam
>>>
>>> On Fri, Nov 9, 2018 at 10:38 AM Joshua Lave <lave at ucar.edu> wrote:
>>>
>>>> I'm not sure this is the right place to ask this question, but I am
>>>> attempting to run a script and am getting a strange error:
>>>>
>>>> fatal:CvtStringGenArrayToColorIndexGenArray: Unable to convert string
>>>> "LightGray" to requested type
>>>>
>>>> warning:Error retrieving resource mpFillColors from args - Ignoring Arg
>>>>
>>>> This is odd to me since I checked the available named colors and
>>>> LightGray is one of them. I have not modified mpFillColors in any way in my
>>>> script. Why am I getting this error and how can I fix it?
>>>>
>>>>
>>>> Thank you,
>>>>
>>>> --
>>>> Joshua Lave
>>>> _______________________________________________
>>>> ncl-talk mailing list
>>>> ncl-talk at ucar.edu
>>>> List instructions, subscriber options, unsubscribe:
>>>> http://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>
>>>
>>
>>
>> --
>> Joshua Lave
>>
>
>
> --
> 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>
>


-- 
Joshua Lave
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20181109/aa9d0e78/attachment.html>


More information about the ncl-talk mailing list