Re: gsn_csm_coutour_map and reource file

From: SR Nelson, School Geographical Sciences <S.R.Nelson_at_nyahnyahspammersnyahnyah>
Date: Tue, 11 Nov 2008 15:48:45 +0000

Many thanks, I shall try the second method.

Sarah

--On 11 November 2008 08:45 -0700 Mary Haley <haley_at_ucar.edu> wrote:

>
> On Tue, 11 Nov 2008, SR Nelson, School Geographical Sciences wrote:
>
>> Hi all,
>>
>> I need to plot a large number of data sets using the
>> gsn_csm_contour_map_xxx functions and was hoping to use a resource file
>> to cut down on large amounts of identical code being repeated in
>> several NCL scripts. However, I'm having a few issues setting these
>> resources.
>>
>> 1) Not all of the resources seem to be being passed to the plotting
>> function and used as switches as indicted by the web documentation
>> page. e.g. *cnFillOn : True
>> results in the plot having filled contours, but does not turn off the
>> information label or add the label bar or continent outlines as it does
>> when set directly in the script.
>>
>> 2) Despite setting *mpFillOn : False this has no effect, and using
>> getvalues after plotting function is called shows mpFillOn = True.
>>
>> Are these problems related to when the resource file is load in relation
>> to when the he gsn_csm_contour_map function is called? Or are they
>> being overwritten? I've tried looking at the code and not found any
>> indication that the latter is happening, but appreciate I may have
>> missed something.
>
> Sarah,
>
> I'm afraid your observations are correct. The gsn_csm_xxxx scripts
> were meant to create a certain look of plot, and hence they set a
> bunch of resources that are different than what a default NCL plot
> would look like. These resources override anything set in a resource
> file. It would be too expensive to check for every possible resource
> that might be set in a resource file, and then not set a resource
> inside of gsn_csm_xxxx as a result.
>
> There are a couple of possible ways that you can set a bunch
> of resources without have them clutter up your code.
>
> One way is to create a file, say "res.ncl" with lines like:
>
> res = True
> res_at_cnFillOn = True
> res_at_cnLinesOn = True
>
> and then you can load this file whenever you want these resources
> set.
>
> load "res.ncl"
>
> Another way is to create a procedure that you have to call:
>
> procedure set_cn_and_mp_res(res:logical)
> begin
> res_at_cnFillOn = True
> res_at_cnLinesOn = False
> res_at_mpFillOn = False
> end
>
> begin
> ...
> res = True
> set_cn_and_mpres(res)
> ...
> end
>
> I prefer the second method.
>
>> Also, I've noticed that when using cnFillOn = True (even when not using
>> a resource file), the contour lines are not turned off as indicated in
>> the web documentation page. Is this correct?
>
> The documentation is wrong. I think it meant to say that
> only the contour line labels are turned off. I have fixed this.
> You will need to set cnLinesOn to False. Thanks for pointing
> this out.
>
> --Mary
>
>>
>> Apologises for the long message, any help would be much appreciated,
>> Regards,
>> Sarah
>>
>>
>> ----------------------
>> Sarah Nelson
>> School Geographical Sciences
>> University of Bristol
>> University Road
>> Bristol BS8 1SS
>> Tel: 0117 3317316
>> _______________________________________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>

----------------------
Sarah Nelson
School Geographical Sciences
University of Bristol
University Road
Bristol BS8 1SS
Tel: 0117 3317316
Received on Tue Nov 11 2008 - 08:48:45 MST

This archive was generated by hypermail 2.2.0 : Fri Nov 14 2008 - 16:42:12 MST