Re: To call a ncl script within another

From: Noel Aloysius <noel.aloysius_at_nyahnyahspammersnyahnyah>
Date: Wed Apr 24 2013 - 08:25:39 MDT

Hi all, sorry for the delay in my response...

Further to my earlier query on calling scripts within script...

NCL script written as follows does the job
_____________________________________________________________________

; 1. load libraries
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 "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"

begin

  ; 2. load data files

  ; 3. declare arrays and other common variables

  ; 4. read data files

  ; 5. perform analyis

  ; 6. create plots/figures
  ; here I call each plot script
  loadscript("~/Figure01.ncl")
  loadscript("~/Figure02.ncl")
  loadscript("~/Figure03.ncl")
       .
       .
       .

end

Noel Aloysius

On Thu, Mar 28, 2013 at 2:35 PM, Dennis Shea <shea@ucar.edu> wrote:

> What about ...
>
> http://www.ncl.ucar.edu/**Document/Functions/Built-in/**loadscript.shtml<http://www.ncl.ucar.edu/Document/Functions/Built-in/loadscript.shtml>
>
>
> On 03/28/2013 12:25 PM, Ping Yang wrote:
>
>> Actually it is no easy, I can pass number but have difficulties in pass
>> the string to call another script.
>>
>> On Thu, Mar 28, 2013 at 2:14 PM, Dave Allured - NOAA Affiliate
>> <dave.allured@noaa.gov <mailto:dave.allured@noaa.gov>**> wrote:
>>
>> NCL has very good support for user-written functions and procedures.
>> Please see the appropriate documentation:
>>
>> http://www.ncl.ucar.edu/**Document/Manuals/Ref_Manual/**
>> NclStatements.shtml#Procedures<http://www.ncl.ucar.edu/Document/Manuals/Ref_Manual/NclStatements.shtml#Procedures>
>>
>> --Dave
>> Please reply to user list only!
>>
>> On Thu, Mar 28, 2013 at 11:27 AM, Noel Aloysius
>> <noel.aloysius@gmail.com <mailto:noel.aloysius@gmail.**com<noel.aloysius@gmail.com>>>
>> wrote:
>> > Hi NCL-talk,
>> >
>> > I have written a script to perform some analysis. Now I want to
>> create
>> > several plots. I want to keep the analysis and plotting part
>> separately.
>> > I would like to know how to call the plot scripts, like the one
>> below, saved
>> > as a separate file (say plot1.ncl) within my main script.
>> >
>> > Thanks,
>> >
>> > ;---------------------- plot1.ncl
>> >
>> > ffig = diro + "Natgrid_interpolation_test_**fig_v1"
>> > wks = gsn_open_wks(type, ffig)
>> > nplots = 1
>> > plot = new(nplots, graphic)
>> > gsn_define_colormap(wks, "ncl_default")
>> > maps = NewList("fifo")
>> >
>> > res1 = True ;
>> plot mods
>> > desired
>> > res1@gsnDraw = False
>> > res1@gsnFrame = False
>> > res1@gsnMaximize = True
>> >
>> > res1@gsnStringFontHeightF = 0.0125
>> > res1@gsnSpreadColors = True
>> > res1@gsnAddCyclic = False
>> >
>> > res1@cnFillMode = "RasterFill"
>> > res1@cnFillOn = True
>> > res1@cnLinesOn = False
>> > res1@cnLineLabelsOn = False
>> >
>> > res1@mpFillOn = False
>> > res1@mpOutlineBoundarySets = "National"
>> > res1@mpPerimOn = True
>> > res1@mpDataBaseVersion = "MediumRes"
>> > res1@mpDataSetName = "Earth..4"
>> > res1@mpOceanFillColor = 1
>> >
>> > plot = gsn_csm_contour_map(wks,**xannet, res1)
>> >
>> > ; draw region of interest
>> > lnres1 = True
>> > lnres1@gsLineColor = "black"
>> > lnres1@gsLineDashPattern = 0
>> > lnres1@gsLineThicknessF = 2.0
>> > ListPush(maps, gsn_add_shapefile_polylines(**
>> wks,plot,fshp1,lnres1))
>> >
>> > draw(wks)
>> > frame(wks)
>> >
>> > ;-----------------------------**---------------
>> ______________________________**_________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/**mailman/listinfo/ncl-talk<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<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 Apr 24 08:25:49 2013

This archive was generated by hypermail 2.1.8 : Thu May 02 2013 - 11:16:45 MDT