[ncl-talk] Missing color fill when using gsn_csm_contour_map (ncl V 6.4.0)

adriana.bossolasco at cnrs-orleans.fr adriana.bossolasco at cnrs-orleans.fr
Wed Aug 22 02:17:42 MDT 2018


Just one more think, now I turn on the contour lines,

;---read in zonal winds
   a = addfile("MAM_GEOS_1anee.cam.h0.2000-12-07-00000.nc","r")
   u = a->U(0,35,:,:)                                ; July zonal winds
printVarSummary (u)
;print(u)
   wks  = gsn_open_wks("png","newcolor")  ; send graphics to PNG file

res                 = True
   res at gsnMaximize     = True       ; maximize in frame
   res at cnLinesOn       = True
   res at cnFillOn        = True
   res at cnFillPalette   = "BlueYellowRed"   ; change the color palette

   res at mpFillDrawOrder = "PostDraw" ; Make sure land fill is drawn
                                    ; on top of filled contours

   res at tiMainString    = "NCL version 6.1.x will give you gray land"

   plot = gsn_csm_contour_map(wks,u,res)
end


And this works, but still without color, see the picture attached.

Thanks

Le 21/08/2018 20:36, Dennis Shea a écrit :
> [0]
> If you are just learning NCL, I suggest you look at the USER MANUAL
> at:
>       HTTP://WWW.NCL.UCAR.EDU/DOCUMENT/MANUALS/ [6]
> 
> [1]
> As noted by Toni,
> 
> u = U(0,,:,:)
> 
> is not correct. In fact, it should have generated a FATAL subscript
> syntax error.
> 
> Note: although "fatal", NCL will continue. In fact, it will still try
> to create the plot. Since it did not have valid data, NCL generated a
> background and a default color lable bar. That is what you attached.
> 
> [2]
> Your following resource setting needs some clarification:
> 
>   res at tiMainString    = "NCL version 6.1.x will give you gray land"
> 
> For historical reasons, NCL's default graphic mode is black-and-white
> (B/W). This is true of *all* NCL versions. Not just 6.1.x.
> 
> When, 'gsn_csm_contour_map' is used, the default background is
> continental outlines with light gray used to fill land areas. See:
> 
>    HTTP://WWW.NCL.UCAR.EDU/APPLICATIONS/CYLINEQ.SHTML [7]
> 
>    Examples 1 and 2
> 
> Color is turned on via:
>    res at cnFillOn = True     ; make color graphic
> 
> When color is activated, (a) the background map including the light
> gray land fil is generated; then, (b) the color contour are drawn over
> that background.  The light gray land fill is overwritten (no big
> deal). The following resource setting tells the 'gsn_csm_contour_map'
> do the colr contours and then force the gray land fill last. [There
> are some reasons for doing that.]
> 
> res at mpFillDrawOrder = "PostDraw" ; Make sure land fill is drawn
>                                    ; on top of filled contours
> 
> [3]
> 
> If you want you can ftp a sample file to:
> 
>   ftp ftp.cgd.ucar.edu [8]
> 
>   anonymous
> 
>   your_email
> 
>   cd incoming
> 
>   put MAM_GEOS_1anee.cam.h0.2000-12-07-00000.nc [9]
> 
>   quit
> 
> On Tue, Aug 21, 2018 at 9:45 AM, Toni Klemm <toni-klemm at tamu.edu>
> wrote:
> 
>> Hi Adriana,
>> 
>> I noticed there are two commas in the command to extract the sind
>> vectors: u = a->U(0,,:,:)  Could that be the problem?
>> 
>> Could you attach the netCDF file from the example that you’re
>> using? (MAM_GEOS_1anee.cam.h0.2000-12-07-00000.nc [1])
>> 
>> Toni
>> 
>> Toni Klemm, Ph.D.
>> Postdoctoral Research Associate
>> Department of Ecosystem Science and Management
>> College of Agriculture and Life Sciences
>> Texas A&M University, College Station, TX
>> Contributor to the Early Career Climate Forum [3]
>> www.toni-klemm.de [4] | @toniklemm [5]
>> 
>>> On Aug 21, 2018, at 10:01 AM, adriana.bossolasco at cnrs-orleans.fr
>>> wrote:
>>> 
>>> Hi all
>>> 
>>> I have a problem with ncl when I try to plot a contour graphic. I
>>> thought it was a mistake I was making, but then when I try with a
>>> example very simple still appears blank. And ncl does not tell me
>>> any error.
>>> Here is the script (have my file but is exactly the same that
>>> newcolor_1.ncl)
>>> 
>>> ;************************************************
>>> ; zonal_2.ncl
>>> ;
>>> ; Concepts illustrated:
>>> ;   - Drawing a zonal means plot
>>> ;   - Using dim_avg_Wrap to calculate a zonal average
>>> ;************************************************
>>> ;load "/usr/lib/ncarg/nclscripts/csm/gsn_code.ncl"
>>> ;load "/usr/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
>>> ;load "/usr/lib/ncarg/nclscripts/csm/contributed.ncl"
>>> ;************************************************
>>> begin
>>> ;************************************************
>>> ; variable and file handling
>>> ;************************************************
>>> ;---read in zonal winds
>>> a = addfile("MAM_GEOS_1anee.cam.h0.2000-12-07-00000.nc [1]","r")
>>> u = a->U(0,,:,:)                                ; July zonal
>>> winds
>>> 
>>> wks  = gsn_open_wks("png","newcolor")  ; send graphics to PNG
>>> file
>>> 
>>> res                 = True
>>> res at gsnMaximize     = True       ; maximize in frame
>>> res at cnLinesOn       = False
>>> res at cnFillOn        = True
>>> res at cnFillPalette   = "BlueYellowRed"   ; change the color
>>> palette
>>> 
>>> res at mpFillDrawOrder = "PostDraw" ; Make sure land fill is drawn
>>> ; on top of filled contours
>>> 
>>> res at tiMainString    = "NCL version 6.1.x will give you gray land"
>>> 
>>> plot = gsn_csm_contour_map(wks,u,res)
>>> end
>>> 
>>> I obtained a map without color fill, I was looking in some
>>> previous talk but nothing works. Can Anyone help me on this?
>>> thanks
>>> I attached the maps
>>> 
>>> Thank you
>>> --
>>> Adriana Bossolasco
>>> LPC2E UMR 7328 (CNRS, Université d'Orléans)
>>> 3A avenue de la Recherche Scientifique
>>> 45071 Orléans Cedex 2 - FRANCE
>>> Tel  +33 (0)2 38 25 52 85
>>> e-mail:
>>> 
>> 
> adriana.bossolasco at cnrs-orleans.fr<newcolor.png>_______________________________________________
>>> ncl-talk mailing list
>>> ncl-talk at ucar.edu
>>> List instructions, subscriber options, unsubscribe:
>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk [2]
>> 
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk [2]
> 
> 
> 
> Links:
> ------
> [1] http://MAM_GEOS_1anee.cam.h0.2000-12-07-00000.nc
> [2] http://mailman.ucar.edu/mailman/listinfo/ncl-talk
> [3] http://www.eccforum.org
> [4] http://www.toni-klemm.de
> [5] http://twitter.com/toniklemm
> [6] http://www.ncl.ucar.edu/Document/Manuals/
> [7] http://www.ncl.ucar.edu/Applications/cylineq.shtml
> [8] http://ftp.cgd.ucar.edu
> [9] http://12-07-00000.nc

-- 
Adriana Bossolasco
LPC2E UMR 7328 (CNRS, Université d'Orléans)
3A avenue de la Recherche Scientifique
45071 Orléans Cedex 2 - FRANCE
Tel  +33 (0)2 38 25 52 85
e-mail: adriana.bossolasco at cnrs-orleans.fr
-------------- next part --------------
A non-text attachment was scrubbed...
Name: newcolor.png
Type: image/png
Size: 396234 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180822/3841cee2/attachment-0001.png>


More information about the ncl-talk mailing list