[ncl-talk] Explicit levels (using WRF output)

Mary Haley haley at ucar.edu
Mon Jan 23 09:17:08 MST 2017


Arianna,

One of the errors is from a stray "l" character in the script I gave you.
The error message told you what line to look at:

fatal:syntax error: line 2 in file plotlanduse_mod_latlon.ncl before or
near \n

The offending line is this one:

load "/usr/share/ncarg/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"l


You need to remove the "l" at the end.

I'm not sure about this error:

fatal:MapV41DHInitialize: dynamic memory allocation error:[errno=12]

It implies some kind of problem with allocating memory, but I didn't run
into this on my system.

Did you change the script that I gave you in any way, or perhaps use a
different data file with it? What version of NCL are you using?

ncl -V

It would help if you could include the modified script.

Thanks,

--Mary



On Mon, Jan 23, 2017 at 4:51 AM, Arianna Valmassoi <
arianna.valmassoi at gmail.com> wrote:

> Hi Mary,
> thank you very much for the code.. I tried to run both of them but I get
> errors like "ERROR    1 IN MAPTRA - UNCLEARED PRIOR ERROR".
>
> I attach the error report: "dump.txt" is for plotlanduse_mod_latlon.ncl
> and "dump_mod.txt" for plotlanduse_mod.ncl
>
> Thanks again for the help!
>
> Cheers
>
> Arianna
>
>
> Il giorno ven 20 gen 2017 alle ore 19:13 Mary Haley <haley at ucar.edu> ha
> scritto:
>
>> Arianna,
>>
>> My apologies, I forgot to set a very critical resource to make the plot
>> be rotated correctly.  I had set the four corners of the projection but
>> forgot this resource:
>>
>>   res at mpLimitMode          = "Corners"
>>
>> Please use the attached script instead, and see the new image.
>>
>> As a check that the data are being plotted correctly, I created a second
>> script that plots the data in a Cylindrical Equidistant map projection,
>> using the XLAT and XLONG read of the file to correctly project the data
>> onto this projection.  See the attached plotlanduse_mod_latlon.ncl script
>> and image.
>>
>> --Mary
>>
>>
>> On Thu, Jan 19, 2017 at 3:29 PM, Arianna Valmassoi <
>> arianna.valmassoi at gmail.com> wrote:
>>
>> Hi Mary,
>> thank you very much, now there is no problem with the filling!
>>
>> Have you notice (and it happened to me before) that in the light blue you
>> can see the world coast-line? (In the figure you sent me there is in the
>> bottom right corner a part of Africa and Madagascar).. I wasn't able to do
>> anything to remove them (without removing the coordinates..)
>>
>> Thank you very much again
>>
>> Cheers
>>
>> Arianna
>>
>> Il giorno gio 19 gen 2017 alle ore 22:20 Mary Haley <haley at ucar.edu> ha
>> scritto:
>>
>> Hi Arianna,
>>
>> NCL does its contouring by filling the contours based on what values fall
>> above or below a contour level, and not exactly equal to a contour level.
>> This causes confusion when your data is all integers.
>>
>> If you specify contour levels of 1,2,3,4,5, then NCL is going to create a
>> contour plot with *6* colors, where the colors represent the following:
>>
>>   color 1 - all values < 1
>>   color 2 - all values >= 1 and < 2
>>   color 3 - all values >= 2 and < 3
>>   color 4 - all values >= 3 and < 4
>>   color 5 - all values >= 4 and < 5
>>   color 6 - all values >= 5
>>
>> This is why you see the extra "Label_1", because NCL only expects (n-1)
>> labels if you have n colors, because it's assuming you are labelling
>> *between* values.  When you tell it to center the labels, then suddenly you
>> are one label short, and hence NCL gives you the "Label_1" label.
>>
>> Back to your contour levels:
>>
>> In your code, you set the first contour level to 1, so this means that
>> the first color (darkgreen) is going to represent all values < 1, which
>> means any value equal to 0, since you only have integer values.
>>
>> Then, then next color, "forestgreen" is going to represent all values >=1
>> and < 2, which, again, in your case, since you just have integers, is going
>> to be all colors equal to 1.
>>
>> If you want the first color to represent all values equal to 1, and the
>> second color all values equal to 2, and you want twenty colors total, where
>> the last color represents values equal to 20, then you need to create 19
>> contour levels that start just slightly higher than 1, 2, 3, 4, etc:
>>
>> This is one way of doing it, by adding 0.1 to the levels:
>>
>>   res at cnLevels  = (/1, 2, 3, 4, 5, 6, 7, 8, 9,10, 11,12,13,14,
>> 15,16,17,18,19/)+0.1
>>
>> I see you are using cnFillPalette, which is okay, but it's better to use
>> cnFillColors when you have a specific color for each contour level.  This
>> way you don't need to mess with gsnSpreadColors:
>>
>>   res at cnFillColors     = colorscheme        ; distinct colors for
>> categories
>>  ; res at gsnSpreadColors = False           ; comment this or remove it
>>
>> If you are trying to plot this data over a map, you generally want to use
>> wrf_contour *and* wrf_map_overlays.  But, your XLAT and XLONG on the file
>> do not have a time dimension, which is going to cause problems for
>> wrf_map_overlays.
>>
>> So, I modified your code to use gsn_csm_contour_map instead, but I used
>> the map projection defined on the file.
>>
>> I've attached the modified script and a new PNG.
>>
>>
>> --Mary
>>
>>
>> On Thu, Jan 19, 2017 at 10:57 AM, Arianna Valmassoi <
>> arianna.valmassoi at gmail.com> wrote:
>>
>> Hi all,
>>
>> I'm working with WRF and it's landuse representation. In the plot output
>> I have the following problems:
>>
>>    - label: there is one more tic in the label with the first color, and
>>    has a name I did not put.
>>    - assign color to discrete numbers: I had to impose to the landcat to
>>    start with zero, not as one as it is, otherwise the first level will not
>>    match
>>    - Domain visualization: I can't use the model coordinates (even using
>>    other plot option)
>>
>>
>> I attach here both the code and the .nc file, in order to help the debug
>> category 13 should be red and category 17 light blue.
>>
>> Thank a lot for any help and sorry if it's a duplicate problem!
>>
>> Cheers,
>> Arianna Valmassoi
>> --
>> Arianna Valmassoi
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>> --
>> Arianna Valmassoi
>>
>>
>> --
> Arianna Valmassoi
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170123/8c22a33e/attachment.html 


More information about the ncl-talk mailing list