NCAR Order Dialect - NCL.


96 views
Uploaded on:
Category: Sales / Marketing
Description
NCAR Summon Dialect - NCL Juli Rew CISL Takes off, June 4, 2008 Outline of NCL Procedures for Survival Work with Sample Programs What We Will Concentrate on NCAR Order Dialect is a finished programming dialect for preparing information and delivering top notch 2D illustrations
Transcripts
Slide 1

NCAR Command Language - NCL Juli Rew CISL SOARS, June 4, 2008

Slide 2

Overview of NCL Strategies for Survival Work with Example Programs What We Will Study

Slide 3

NCAR Command Language is a finished programming dialect for preparing information and delivering top notch 2D representation NCL charges can be keep running at the summon line, or they can be set in cluster scripts What is NCL?

Slide 4

NCL is based on top of NCAR Graphics, which was initially composed in Fortran NCAR Graphics was re-composed in item situated structure, and NCL lives up to expectations with graphical “objects” Thanks to Mary Haley of the CISL Visualization and Technology Section for a significant part of the preparation data given here NCL History

Slide 5

Freely accessible Easier to use than customary programming Competes well with extravagant items, for example, IDL Versatile - it can acknowledge and yield information in an assortment of arrangements Produces distribution quality representation Why Use NCL?

Slide 6

NCL has such a large number of elements that it can require a ton of investment to ace NCL has around 800 capacities Before composing any new NCL code, take a gander at the downloadable illustrations to check whether one fits GSUN instructional exercise http://www.ncl.ucar.edu/Document/Manuals/Getting_Started/GSUN line-by-line cases www.ncl.ucar.edu/Document/Manuals/Getting_Started/examples.shtml Strategies for Survival

Slide 7

Use the gsn and csm libraries Documentation is accessible online at: http://www.ncl.ucar.edu/Help from kindred clients by joining ncl-talk@ucar.edu Subscribe at http://mailman.ucar.edu/postal carrier/listinfo/ncl-talk Support: Mary Haley ( haley@ucar.edu , ML 35) Strategies for Survival, cont.

Slide 8

start/end - to begin/end scripts (discretionary) ; - Comment @ - Attribute, e.g., temperature@units = “Degrees C” Operators like Fortran - + - *, .le., .lt., and so on. All parameters are gone by reference (as in Fortran) NCL Syntax

Slide 9

Indexes begin at 0 (like C) 1D, number: a = (/1,2,3/) 2D, drift: b = (/1.1, .01/),/(.001,.0001/)/) Whole-cluster sentence structure is similar to Fortran a=b a*b (more productive than circling to duplicate exhibit) Arrays

Slide 10

Dimensions can be named: temperature!0 = “frtime” temperature!1 = “lat” temperature!2 = “lon” Strings - encased in twofold quotes Syntax, cont.

Slide 11

Coordinate variables - 1D exhibits with same name and size as the measurements they are relegated to - Represent information arranges for every record of a named measurement - Must be monotonically expanding/diminishing temperature & frtime = figure times temperature & lat = lat_points temperature & lon = lon_points Coordinate subscripts temperature (0,{20:60},{-95:- 120}) Syntax, cont.

Slide 12

We will underscore illustrations highlights here Some cases of information and yield to/from ASCII content and netCDF information records Graphics

Slide 13

Load vital libraries Open “workstation” to send design to Change the shading guide (discretionary) Set plot assets (discretionary) Draw the representation Minimum Steps Needed to Create a Plot

Slide 14

load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl” First library contains “generic” interfaces and supplemental schedules Second library contains gsn_csm interfaces that utilization CSM traditions. Burden request is critical. CSM traditions are acknowledged approaches to name information, e.g., units 1. Load the Necessary Libraries

Slide 15

programmed subtitles shape line names tickmarks out & lat/lon marks instructive name programmed labelbar “basic” interface “metadata aware” interface

Slide 16

Can be PostScript (PS or EPS), PDF, X11 window, or NCAR CGM (NCGM) Has a default shading guide connected with it, however you will most likely need to change this (all the more later) Can have up to 15 various workstations open 2. Open representation “workstation” wks = gsn_open_wks (“x11”,”test”) ; x11 window wks = gsn_open_wks (“ps”,”test”) ; “test.ps” wks = gsn_open_wks (“eps”,”wrf”) ; “wrf.eps” wks = gsn_open_wks (“pdf”,”slp”) ; “slp.pdf”

Slide 17

Do this before attracting anything to the edge. On the off chance that you utilize the same shading guide a great deal, can put in “.hluresfile” (all the more later) Can utilize one of the other 40+ ones, or make your own. On the off chance that you don’t change the shading guide, here’s what you’ll get… 3. Change the shading guide (opt’l) gsn_define_colormap (wks,”rainbow”)

Slide 18

list 0 is the foundation shading file 1 is the closer view shading Pick a superior shading table… or make your own particular http://www.ncl.ucar.edu/Document/Graphics/color_table_gallery.shtml http://www.ncl.ucar.edu/Document/Graphics/create_color_table.shtml Default shading table (yuck)

Slide 19

Resources are the heart of your NCL illustrations code. There are more than 1,400 assets! Assets are gathered by item sort. There are 11 “graphical” articles: forms, labelbars, legends, maps, primitives, streamlines, content strings, tickmarks, titles, vectors, XY plots 4. Set discretionary assets

Slide 20

Starts with 2 or 3 lower-case letters in view of article it is connected with. A few cases: “ xy ” - XY Plots “ cn ” - Contour plots “ vc ” - Vector plots “ ti ” - Titles “ tm ” - Tickmarks “ gsn ” - exceptional assets not associated with any article Made up of full words with first letter of word promoted: “ xyLineColor ”, “ cnFillOn ”, “ tiMainString ”, “ vcRefMagnitudeF ”, “ gsnMaximize ” Some have a “F” on the end to show a drifting point asset: “ xyLineThicknessF ” Detour: Anatomy of an asset

Slide 21

Resources are set by connecting them as ascribes to a NCL sensible variable: res = True res@ mpMinLatF = 30 ; decimal a bit much Most have default values. There are numerous sorts: res@ tiMainString = “This is a title” res@ tmXBLabelFontHeightF = 0.01 res@ cnLineLabelsOn = True res@ xyLineColors = (/5,7,11/) res@ xyLineColors = (/“red”, “green”, “blue”/) Anatomy of an asset (cont’d) http://www.ncl.ucar.edu/Document/Graphics/Resources/

Slide 22

Call one of the gsn_csm_ xxxxx capacities from the second library we stacked. The general configuration is: plot = gsn_csm_contour ( wks,data,res ) plot = gsn_csm_vector ( wks,u,v,res ) plot = gsn_csm_contour_map ( wks,data,res ) plot = gsn_csm_pres_hgt ( wks,data,res ) 5. Draw the illustrations http://www.ncl.ucar.edu/Document/Graphics/Interfaces/

Slide 23

NCL scripts that take after can be downloaded from the web: Now for Some NCL Graphics Code Examples http://www.ncl.ucar.edu/Training/Workshops/Scripts/Scripts have names like xy1a.ncl, xy1b.ncl, … The first is normally one without any assets set, and each resulting script includes a couple of more assets.

Slide 24

setenv NCARG_ROOT ~/ncl-4.2.0.a034 Go to illustration NCL scripts catalog: disc SOARS/NCL To run these scripts: ncl xy1a.ncl Let’s take a gander at what’s in our first script utilizing vi: vi xy1a.ncl Running NCL

Slide 25

Line shading changed (utilizing shading list qualities) Default shading guide utilized Resource presented: xyLineColor - sets bend shading Example xy1b.ncl gsn_csm_y

Slide 26

X qualities included Line shading changed (utilizing named shading) Line thickness expanded “long_name” properties set Resource presented: xyLineThicknessF - sets line thickness Example xy1c.ncl gsn_csm_xy

Slide 27

Axes cutoff points changed Resources presented: trYMinF, trYMaxF, trXMinF, trXMaxF - sets mins and maxes for X and Y tomahawks ( tr ansformation assets) These assets can likewise apply to shape, vector, and streamline plots Example xy1d.ncl gsn_csm_xy

Slide 28

Dash example set for bend Title assets set Resources presented: xyDashPattern - sets dash design for bend (17 accessible) tiMainString, tiXAxisString, tiYAxisString - sets strings for tomahawks and principle title, can likewise be utilized for form, vector, and so on, plots If have both long_name characteristics and tiX/YString set, ti* assets will produce results Example xy1e.ncl gsn_csm_xy

Slide 29

Explicitly set the base tickmark names Resources presented: tmXBMode, tmXBValues, tmXBLabels - sets strings for base tickmarks Note about tickmark assets: every one of the four sides of the tomahawks have their own arrangement of tickmarks, for instance: tmYLMode (Y left), tmYRMode (Y right), tmXTMode (X top) Example xy1f.ncl gsn_csm_xy

Slide 30

Generating some counterfeit wind information Each exhibit section has two segments: wind speed and wind course There is an uncommon capacity for making wind roses, called WindRoseBasic Data will be composed to an ASCII record This sample online at http://www.ncl.ucar.edu/Applications/rose.shtml Example rose_1.ncl

Slide 31

Now we are perusing our information from an ASCII document called “Bogus.dat” that we made already Recall that there are two segments to every cluster passage Example rose_1a.ncl

Slide 32

This case peruses from a netCDF record and shapes the temperature handle Fourth plot utilizes a predefined shading table; see www.ncl.ucar.edu/Document/Graphics/color_table_gallery.shtml Original case online at: www.ncl.ucar.edu/Document/Manuals/Getting_Started/Examples/gsun02n.shtml Example contour.ncl

Slide 33

Animate NCL picture documents utilizing idt (a piece of NCL) Movies: Save arrangement of pictures to Postscript documents. Believer pictures to mpg utilizing “convert” utility of ImageMagick Or utilization utility,

Recommended
View more...