Re: skewt_func()

From: David Brown <dbrown_at_nyahnyahspammersnyahnyah>
Date: Wed Feb 15 2012 - 14:27:50 MST

Hi Paul,

I agree with Mary that this like has nothing to do with the skewt code, and is more likely a problem in the NCL code itself.
I was able to duplicate your problem with a simplified version of your code fragments, and unfortunately Mary's suggestion for a workaround does not help.
I can also see that reversing the order of execution makes the problem go away. I will investigate further.
FYI here is the runnable code that shows the problem:

load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/skewt_func.ncl"

procedure sounding()
begin
        wks = gsn_open_wks("x11","test")
        skewt_bkgd = skewT_BackGround(wks, False)
        draw(skewt_bkgd)
        frame(wks)
end

procedure plot_contour()
begin
        appid = NhlAppGetDefaultParentId()
        print(appid) ; if plot_contour is executed first this prints a valid object id -- if second it prints a missing value
        x =create "name" imageWorkstationClass appid
        end create
end

begin
        sounding()
        plot_contour()
end

On Feb 15, 2012, at 1:03 PM, Mary Haley wrote:

> Hi Paul,
>
> I think this has to do with some weird parent/child stuff going on internally with the workstations.
>
> When you call gsn_open_wks, it creates a "default parent" for the workstations, of which I think only one can exist.
>
> Hence, when you call the "create" block to create an image workstation, the "defaultapp" that you are trying to use
> is invalid. I think Dave would have to explain this.
>
> Maybe this would work inside of plot_contour:
>
> begin
> appid = NhlAppGetDefaultParentId()
> wks2 = create "name" imageWorkstationClass appid
> …
> end create
> end
>
> --Mary
>
>
> On Feb 14, 2012, at 10:30 AM, Paul Scorer wrote:
>
>> Greetings,
>>
>> [Maybe this is one for Dennis Shea: his name is all over the code :-) ]
>>
>> I have an interesting issue with skewt_func() (admittedly slightly
>> modified)
>>
>> I hope the code outline below is enough to specify the problem.
>>
>>
>> procedure sounding(...)
>> begin
>> wks = gsn_open_wks(...)
>> skewt_bkgd = skewT_BackGround(wks, opts)
>> draw(skewt_bkgd)
>> skewt_data = skewT_PlotData(wks, skewt_bkgd, ...)
>> frame(wks)
>> end
>>
>> procedure plot_contour(...)
>> begin
>> create "name" imageWorkstationClass defaultapp
>> ; wkHeight, Width, etc
>> end create
>> ...
>> end
>>
>> If the above are called thus
>>
>> begin
>> ...
>> sounding(...)
>> plot_contour(...)
>> ...
>> end
>>
>> then it bombs with
>> fatal:_NclCreateHLUObjOp: Parent value is not an hlu object or is undefined
>>
>> Line number indicated is that of "end create". I get the same behaviour
>> with xWorkStationClass (Both "sounding" & "plot_contour" use the same
>> WorkStationClass).
>>
>> However, if called like this
>>
>> begin
>> ...
>> plot_contour(...)
>> sounding(...)
>> end
>>
>> Everything is OK (for both .png and X11)!
>>
>> Clearly the fix is obvious, but it would be nice to make the code fully
>> bulletproof.
>>
>> Any ideas?
>>
>> Thanks
>>
>> PaulS
>>
>>
>>
>> _______________________________________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Feb 15 14:28:03 2012

This archive was generated by hypermail 2.1.8 : Fri Feb 17 2012 - 08:50:10 MST