[ncl-talk] Problem with overlay procedure

Adam Phillips asphilli at ucar.edu
Tue May 30 12:39:27 MDT 2017


Hi Anne,
Without being able to run your script from here, my best guess on your
issue is that you are overlaying a color-filled contour field on a 2nd
color-filled contour field. I would try setting the opacity of the your
chla_plot to be semi-transparent. Add this line to your res2 resource list.
res2 at cnFillOpacityF = 0.5

The resulting plot should show both your chla and buff plots. More
information about the various opacity resources can be found here:
http://www.ncl.ucar.edu/Applications/rgbacolor.shtml

Other minor things that I see:
- You do not need to set sfXArray or sfYArray as your chla and buff arrays
have attached latitude/longitude coordinate variables. You also do not need
to set those resources in your mpres resource list as they are not needed
when using gsn_csm_map.
- I do not think you need to set res at cnFillDrawOrder.
- You create a mpres resource list, and then create a res and a res2
resource list from mpres, and that carries your map resource settings
through to res and res2. I think simply deleting this line: res = mpres
will get rid of many (if not all) of your error messages.

If that above does not solve your plotting issue please respond to the
ncl-talk email list.
Adam


On Mon, May 29, 2017 at 3:47 AM, Anne <anne.seidenglanz at unive.it> wrote:

> Hi everybody,
>
> I have a problem overlay-ing two contour fields on a map plot (see script
> attached). The final purpose is to mask out a specified area on a global
> triangular grid (simply consisting of ones and zeros), and to create a
> buffer zone around the area for physical reasons. Creating the mask itself
> is no problem, but when I want to overlay the layers for creating the
> buffer zone (for which each layer is just slightly bigger than the
> following one), NCL just plots me the last overlaid field. So when I do
> (here an example of 2 contour fields on top of each other):
>
>     map_plot  =  gsn_csm_map(wks, mpres)
>     chla_plot =  gsn_csm_contour(wks, chla, res2)
>     buff_plot = gsn_csm_contour(wks, buff, res)
>
>     overlay(map_plot, buff_plot)
>     overlay(map_plot, chla_plot)
>
> then only 'chla_plot' is successfully overlaid on the map plot, but not
> 'buff_plot' (which is bigger in spatial extent than 'chla'). There are some
> error messages regarding resources that cannot be used but because I can
> successfully plot each field on top of the map plot separately (apart from
> the red line when plotting 'buff'), I assume they are not important.
>
> A few things to note:
> 0) Both chla and buff have associated coordinate arrays.
> 1)  gsn_csm_contour_map_overlay did not work either, it plots only 'chla'
> and some strange contour labels for 'buff', but distorted.
> 2)  switching off the satellite projection did not make any difference
> 3)  I can plot each field ('chla' and 'buff') separately overlaid on the
> map successfully
> 4)  I have also tried to use gsn_csm_contour_map but because I can use
> this only as my base plot, the overlaid contours (chla and buff) look
> disorted using gsn_csm_contour.
>
> Anybody any idea? Any help is appreciated!
>
> Thanks,
> Anne
>
>
>
>
> "Nota automatica aggiunta dal sistema di posta.
> Please note that the above message is addressed only to individuals filing
> Italian income tax returns."
>
> _______________________________________________
> 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>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170530/b520bb75/attachment.html 


More information about the ncl-talk mailing list