Re-using Backgrounds

From: Paul Scorer <paul.scorer01_at_nyahnyahspammersnyahnyah>
Date: Tue Nov 29 2011 - 14:40:01 MST

I am attempting to create a reusable background.

The real code is significantly more complicated, and the data files
huge, but the idea is _illustrated_ by the code below (although it
obviously won't run!).

I would also note that the do ... end do is in a separate file, if that
is relevant.

My code basically works, except that I get a warning:

        warning:_NhlSetValues:wkFileName does not have "S" access

I have only been able to establish that 'some values do not have "S"

Further, the output filenames are "tmp.000001,png", "tmp.000002.png"

The only workaround I can think of is to do

system("mv tmp.000001.png " + "ParameterFilename")

But how can I find out what is the current tmp filename?

I have established that doing something like
getvalues wks
        "wkFileName" : fname
        end getvalues
only yields "tmp.png"

Can anything be done about this?

I hope this is sufficient information.

Regards & Many Thanks in anticipation.



; Create a workstation
wks = create "tmp" imageWorkStationClass defaultapp
        ; stuff here, eg Height, Width, ...
end create

; Stop the background being drawn
opts_bg = True
opts_bg@gsnDraw = False
opts_bg@gsnFrame = False

; Specify other details, etc
opts_bg@mpProjection = ...
; also Corners, etc, etc

; Create the background map
bg = gsn_csm_map(wks, opts_bg)

; Loop over lots of parameters, all to have the same background
do parameter = 0,N

        ; Create the parameter contour, to go onto the background map

        ; Don't draw it yet
        opts_cn@gsnDraw = False
        opts_cn@gsnFrame = False

        ; duplicate the background, so can re-use
        param_bg = bg

        ; set individual parameter filename
        setvalues wks
                "wkFileName" : "ParameterFileName"
        end setvalues

        ; create the contour
        contour = gsn_csm_contour(wks, data, opts_cn)

        ; Put the contour onto the background
        overlay(param_bg, contour)

        ; Draw the plot
        ; Advance the frame

        ; Destroy the copied background, so can recreate

ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
Received on Tue Nov 29 14:40:15 2011

This archive was generated by hypermail 2.1.8 : Wed Nov 30 2011 - 19:52:47 MST