[ncl-talk] multi-panel wkSpaceTime

Adam Phillips asphilli at ucar.edu
Wed Feb 8 10:41:39 MST 2017


Hi Jyothi,
I downloaded what Dennis provided on the ftp site and was able to run his
example using NCL v6.3.0. Your first error message states that ezfftf_n is
undefined. ezfftf_n was added to the NCL language in version 6.3.0. I am
guessing you are running an older version of NCL. I would advise you to
upgrade to v6.3.0, or if you cannot, modify diagnostics_cam_panel_new.ncl
to use ezfft (which is in older versions of NCL).

I have taken a version of Dennis' wkSpaceTime_1.ncl_panel script and
modified it so that multiple simulations can be read in and paneled
together by plot type as opposed to by model. (Note that I read in the same
data 3 times, but that should not matter.) I have attached that version of
Dennis' script along with a couple examples of the output.
Hope that helps!
Adam

On Wed, Feb 8, 2017 at 7:29 AM, Millie J <millie.jyo at gmail.com> wrote:

> Hi,
>
> Thank you. I need Fig.1 (or Figure 2 / 3a / 3b) for 5 different model
> output data on one panel, for instance, 5 different netcdf datasets, '
> OLR.12hr_2yrs.wheeler_model1.nc', ............,'OLR.12hr_2yrs.
> wheeler_model5.nc'.
>
> Can the code be changed for this purpose? Also, I was not able to run the
> script & sample data (the errors are pasted below). I need the code for
> 'wkSpaceTime' (perhaps this is because of the 'wkSpaceTime_cam' generic CAM
> interface call?).
>
> thanks
> Jyothi
> GMAO / NASA GSFC
>
> *Script Mods & Errors*:
>
> 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/contributed.ncl"
>
> load "/gpfsm/dnb78s1/projects/p18/jnattala/RMM/CGD_PANEL/
> diagnostics_cam_panel_new.ncl"
>
>
> fatal:Undefined identifier: (ezfftf_n) is undefined, can't continue
>
> fatal:["Execute.c":8128]:Execute: Error occurred at or near line 139 in
> file /gpfsm/dnb78s1/projects/p18/jnattala/RMM/CGD_PANEL/
> diagnostics_cam_panel_new.ncl
>
>
> fatal:["Execute.c":8128]:Execute: Error occurred at or near line 655 in
> file /gpfsm/dnb78s1/projects/p18/jnattala/RMM/CGD_PANEL/
> diagnostics_cam_panel_new.ncl
>
>
> fatal:["Execute.c":8128]:Execute: Error occurred at or near line 1496 in
> file /gpfsm/dnb78s1/projects/p18/jnattala/RMM/CGD_PANEL/
> diagnostics_cam_panel_new.ncl
>
>
> fatal:["Execute.c":8128]:Execute: Error occurred at or near line 61 in
> file wkSpaceTime_1_panel.ncl
>
>
> fatal:Variable (PLOT_SPCTIM) is undefined
>
> fatal:["Execute.c":8128]:Execute: Error occurred at or near line 72 in
> file wkSpaceTime_1_panel.ncl
>
> On Mon, Feb 6, 2017 at 5:39 PM, Dennis Shea <shea at ucar.edu> wrote:
>
>> Hello,
>>
>> A paneled Space-Time plot via NCL. Note the driver is a function not a
>> procedure. You (the user) can panel as desired.
>>
>> A script, sample data file and resultant figure my be obtained at:
>>
>> ftp ftp.cgd.ucar.edu
>> anonymous
>> your_email
>> cd wkSpaceTime
>> prompt
>> ls
>> mget *
>> quit
>>
>> Cheers
>>
>> -rw-r--r-- 1 shea cgdcas   139916 Feb  6 15:32
>> diagnostics_cam_panel.ncl_new
>> -rw-r--r-- 1 shea cgdcas 30699392 Feb  6 15:32 OLR.12hr_2yrs.wheeler.nc
>> -rw-r--r-- 1 shea cgdcas   260095 Feb  6 15:33 SpaceTimePanel.png
>> -rw-r--r-- 1 shea cgdcas     3049 Feb  6 15:32 wkSpaceTime_1.ncl_panel
>>
>>
>> On Sun, Jan 29, 2017 at 9:56 AM, Mary Haley <haley at ucar.edu> wrote:
>>
>>> To add this this, you may need to make sure that anything that's
>>> attached to a plot via a gsn_add_text or gsn_add_polyline call continues to
>>> "live" outside the script that it was called from. This means that the
>>> unique id returned from each of these calls must be attached as an
>>> attribute to the plot.
>>>
>>> For example, in the procedure "addHorVertLines", you have this code:
>>>
>>> begin
>>>     gsres = True
>>>     gsres at gsLineDashPattern = 1
>>>
>>>     gsn_polyline(wks, plot, x1,y1,gsres)
>>>     gsn_polyline(wks, plot, x1,y2,gsres)
>>>     gsn_polyline(wks, plot, x1,y3,gsres)
>>>     gsn_polyline(wks, plot, x2,y4,gsres)
>>>
>>>     txres        = True
>>>     txres at txJust = "CenterLeft"
>>>     txres at txFontHeightF = 0.013
>>>
>>>     gsn_text(wks, plot, "3 days" ,-14.7,.345,txres)
>>>     gsn_text(wks, plot, "6 days" ,-14.7,.175,txres)
>>>     gsn_text(wks, plot, "30 days",-14.7,.045,txres)
>>> end
>>>
>>> which needs to have all the gsn_polyline and gsn_text calls changed to
>>> gsn_add_polyline and gsn_add_text, but they also need to be returned from
>>> this procedure. You can use "unique_string" to generate a unique id each
>>> time:
>>>
>>> begin
>>>     gsres = True
>>>     gsres at gsLineDashPattern = 1
>>>
>>>     plot@$unique_string("poly")$ = gsn_add_polyline(wks, plot,
>>> x1,y1,gsres)
>>>     plot@$unique_string("poly")$ = gsn_add_polyline(wks, plot,
>>> x1,y2,gsres)
>>>     plot@$unique_string("poly")$ = gsn_add_polyline(wks, plot,
>>> x1,y3,gsres)
>>>     plot@$unique_string("poly")$ = gsn_add_polyline(wks, plot,
>>> x2,y4,gsres)
>>>
>>>     txres        = True
>>>     txres at txJust = "CenterLeft"
>>>     txres at txFontHeightF = 0.013
>>>
>>>     plot@$unique_string("text")$ = gsn_add_text(wks, plot, "3 days"
>>> ,-14.7,.345,txres)
>>>     plot@$unique_string("text")$ = gsn_add_text(wks, plot, "6 days"
>>> ,-14.7,.175,txres)
>>>     plot@$unique_string("text")$ = gsn_add_text(wks, plot, "30
>>> days",-14.7,.045,txres)
>>> end
>>>
>>> You can also do it like this, for slightly cleaner code, but it does
>>> require that you create some arrays ahead of time with "new" to hold all
>>> the text and polylines being added:
>>>
>>> ;---Create arrays to hold polylines and text
>>> polyid = new(4,graphic)
>>>     textid = new(3,graphic)
>>>
>>>     polyid(0) = gsn_add_polyline(wks, plot, x1,y1,gsres)
>>>     polyid(1) = gsn_add_polyline(wks, plot, x1,y2,gsres)
>>>     polyid(2) = gsn_add_polyline(wks, plot, x1,y3,gsres)
>>>     polyid(3) = gsn_add_polyline(wks, plot, x2,y4,gsres)
>>>
>>>     txres        = True
>>>     txres at txJust = "CenterLeft"
>>>     txres at txFontHeightF = 0.013
>>>
>>>     textid(0) = gsn_add_text(wks, plot, "3 days" ,-14.7,.345,txres)
>>>     textid(1) = gsn_add_text(wks, plot, "6 days" ,-14.7,.175,txres)
>>>     textid(2) = gsn_add_text(wks, plot, "30 days",-14.7,.045,txres)
>>>
>>> ;---Make sure polyid and textid continue to "live" outside this
>>> procedure
>>>
>>>     plot at unique_string("poly") = polyid
>>>     plot at unique_string("text") = textid
>>>
>>> See the attached diagnostics_cam_panel.ncl. This is UNTESTED, but
>>> hopefully it gives you an idea where to start.
>>>
>>> --Mary
>>>
>>>
>>> On Sat, Jan 28, 2017 at 8:54 AM, Dennis Shea <shea at ucar.edu> wrote:
>>>
>>>> When I wrote the functions, my focus was on doing the computations and
>>>> graphics correctly. Paneling the graphics was not a priority. To be honest,
>>>> I did not even think about paneling. :-(
>>>>
>>>> It would be possible to restructure ('refactor') the code. However, it
>>>> would require some time and .effort.
>>>> [1] copy the code:
>>>>      cp $NCARG_ROOT/lib/ncarg/nclscripts/csm/diagnostics_cam.ncl
>>>> diagnostics_cam.panel.ncl
>>>>
>>>> [2] Change the local code: add 'res at gsnDraw=False' in multiple places;
>>>> change 'polyline' procedure calls to the 'gsn_add_polyline' functions, etc
>>>>
>>>> ---
>>>>
>>>> Perhaps, using Imagemagick's  'convert' tool.
>>>>
>>>> %> convert <return>
>>>>
>>>> See the -append /+append options
>>>>
>>>> I have not used the 'append' option very often. 'convert' has other
>>>> options that may also be of use.  See:
>>>>
>>>>         http://www.imagemagick.org/Usage/layers/
>>>>
>>>> This link has numerous examples.
>>>>
>>>> ------
>>>>
>>>> Consider image1.png, image2.png, image3.png, image4.png
>>>>
>>>> %> convert -append image1.png image2.png IMAGE_12.TopBottom.png
>>>> %> display IMAGE_12.TopBottom.png
>>>>
>>>> %> convert -append image3.png image4.png IMAGE_34.TopBottom.png
>>>> %> display IMAGE_34.TopBottom.png
>>>>
>>>> %> convert +append IMAGE_12.TopBottom.png  IMAGE_34.TopBottom.png
>>>> IMAGE_2x2.png
>>>> %> display IMAGE_2x2.png
>>>>
>>>> ---
>>>> This type of thing could be invoked within an NCL script to save
>>>> manually doing it. How?
>>>> After the 'image[1-4].png' have been created .... EG
>>>>
>>>>  wkSpaceTime (u,  diro, case, VAR, ,latBound, spd , nDayWin, nDaySkip, opt  ) ; create images
>>>>
>>>>   system("convert -append   image1.png   image2.png
>>>> IMAGE_12.TopBottom.png")
>>>>   system("convert -append   image3.png   image4.png
>>>> IMAGE_34.TopBottom.png")
>>>>   system("convert +append IMAGE_12.TopBottom.png
>>>> IMAGE_34.TopBottom.png  IMAGE_2x2.png")
>>>>   system("rm IMAGE*TopBottom.png")
>>>>
>>>> ---
>>>> Two on top; one at bottom
>>>>
>>>> %> convert +append image1.png image2.png IMAGE_12.LeftRight.png
>>>> %> display IMAGE_12.LeftRight.png
>>>>
>>>> %> convert -append IMAGE_12.LeftRight.png   image3.png IMAGE_123.png
>>>> %> display IMAGE_123.png
>>>>
>>>> I am sure you can 'center' the bottom figure but I'll leave that up to
>>>> you.  :-)
>>>>
>>>> ----
>>>> From the above link: 10 figures
>>>>
>>>> convert \( font_1.gif font_2.gif font_3.gif +append \) \
>>>>              \( font_4.gif font_5.gif font_6.gif +append \) \
>>>>              \( font_7.gif font_8.gif font_9.gif +append \) \
>>>>              \( -size 32x32 xc:none  font_0.gif +append \) \
>>>>                -background none -append   append_array.gif
>>>>
>>>>
>>>>
>>>> I hope it works for you.
>>>>
>>>> Good luck
>>>> D
>>>>
>>>>
>>>>
>>>>
>>>> On Fri, Jan 27, 2017 at 5:45 PM, Millie J <millie.jyo at gmail.com> wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> Is there a way to plot the Wheeler-Kiladis space-time spectra (Figs. 1
>>>>> to 3), for multiple model outputs, on a single graphic plot? Thanks.
>>>>> Jyothi
>>>>>
>>>>>
>>>>> Jyothi Nattala
>>>>> GMAO / NASA GSFC
>>>>>
>>>>> _______________________________________________
>>>>> ncl-talk mailing list
>>>>> ncl-talk at ucar.edu
>>>>> List instructions, subscriber options, unsubscribe:
>>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>>>
>>>>>
>>>>
>>>> _______________________________________________
>>>> ncl-talk mailing list
>>>> ncl-talk at ucar.edu
>>>> List instructions, subscriber options, unsubscribe:
>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>>
>>>>
>>>
>>> _______________________________________________
>>> ncl-talk mailing list
>>> ncl-talk at ucar.edu
>>> List instructions, subscriber options, unsubscribe:
>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>
>>>
>>
>
> _______________________________________________
> 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/20170208/d5b19435/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: wkSpaceTime_2.ncl_panel
Type: application/octet-stream
Size: 3500 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170208/d5b19435/attachment-0001.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: SpaceTimePanel.000001.png
Type: image/png
Size: 178611 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170208/d5b19435/attachment-0002.png 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: SpaceTimePanel.000003.png
Type: image/png
Size: 97084 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170208/d5b19435/attachment-0003.png 


More information about the ncl-talk mailing list