460 likes | 642 Views
Workshop Overview. Labs important: you must invest the time
E N D
2. Workshop Overview Labs important: you must invest the time
osmosis method of learning does not work
3. NCL variable model is based on the netCDF variable model
4. netCDF files self describing
(ideally) all info contained within the file
no external information needed to determine file contents
portable [machine independent]
5. Examining a netCDF file ncdump file_name | less
dumps the entire contents of a file; prints every value
ncdump -h file_name | less
Dumps header information [most commonly used]
NCL equivalent: ncl_filedump file_name | less
ncdump -v U file_name | less
NCL equivalent: ncl_filedump v U file_name | less
Note: ncdump is a Unidata utility
not a netCDF Operator (NCO / CDO)
not associated with NCL
6. Parts of netCDF file
7. netCDF/NCL variable array [could be of length 1 (scalar)]
(may) have additional information
8. visual: simple 2D netCDF Variable coordinate variables (rectilinear grid)
9. netCDF [NCL] Variable model
10. Detailed Look netCDF Variable (NCL)
11. Why Know NCL/netCDF Variable Model
12. Integrated processing environment
13. NCL Support Documentation and Examples
http://www.ncl.ucar.edu/
numerous downloadable examples to get you going
downloadable reference manuals [pdf], FAQ
14. NCAR Command Language Complete Programming Language
data types
variables
operators
expressions
conditional statements
loops
functions/procedures/graphics
15. Running NCL Interactive Mode (Command line)
ncl [options][command-line-arguments] <return>
ncl> enter commands
ncl> quit <return>
can save interactive commands
ncl> record file_name
ncl> stop record
16. NCL predefined options ncl hnxV [predfined options are preceded by dash]
may be used for interactive or batch mode
informational
ncl h [display predefined options and usage and exit]
ncl V [print the NCL version and exit]
action
ncl x [echo statements as encountered (debug)]
ncl n [don't enumerate dimensions of values in print() ]
multiple predefined options
ncl nx [ not ncl n x ]
17. Sample Batch Script: sample.ncl
20. Outline: NCL Language Basics special syntax characters
data types
Variables ? netCDF/NCL variable model
attributes
_FillValue
named dimensions
coordinate variables
print and printVarSummary
shaping
subscripting
21. NCL Syntax Characters
22. Data Types Numeric
double (64 bit)
float (32 bit)
long (32 or 64 bit)
integer (32 bit)
short (16 bit)
byte ( 8 bit, 0-255)
complex NOT supported non-Numeric
string
character
graphic
file
logical
list
23. Simple Variable Assignment
24. Conversion between data types NCL is a strongly typed language
coercion
implicit conversion of one type to another
automatic coercion when no info is lost
let i be integer and x be float or double
fortran: x=i and i=x
NCL: x=i and i=toint(x)
many functions to perform conversions
25. Attributes
26. _FillValue Unidata and NCL reserved attribute
most NCL functions ignore _FillValue
27. Interactive: Variable_1
28. Arrays
29. NCL (netCDF) Dimensions
30. NCL (netCDF) Coordinate Variables data coordinates [ eg: time, level, lat, lon ]
strict netCDF definition
1D numeric array
monotonically in[de]creasing numeric values
can only be assigned to a named dimension
1D array must be the same size as dimension
should not have _FillValue attribute
coordinate values assigned via & character
T&lat = latitude
31. Create and Assign Coordinate Variables
32. Access/Change/Create/Delete Meta Data
33. netCDF [NCL] Variable model
34. Variable Assignment
35. Interactive: Variable_2
36. Variable Reshaping/Reordering
37. Variable Subscripting (1 of 3) Standard Array Subscripting
ranges: start/end and [optional] stride
indices separated by :
omitting start/end index implies default begin/end
38. Variable Subscripting (2 of 3) Coordinate Variable Subscripting
only applies to coordinate variables
same rules apply for ranges, strides, defaults
use curly brackets {}
standard and coordinate subs can be mixed
[if no reorder]
39. Variable Subscripting (3 of 3) Named Dimensions
only used for dimension reordering
indicated by |
dim names must be used for each subscript
named/coordinate subscripting can be mixed
40. Standard and Coordinate Subscripting
41. Interactive: Variable_3
42. printing
43. printVarSummary Print out variable (data object) information
type
dimension information
coordinate information (if present)
attributes (if present)
printVarSummary (u)
44. print (1 of 3)
45. print (2 of 3)
46. print (3 of 3)
47. write_matrix(x[*][*], fmt, opt)