The convention within this document is that methods can be used as
functions.
However, functions are not and cannot be used as methods.
Methods can be daisy changed together and their syntax is cleaner than
functions.
Method names are reserved words and CANNOT be used as variable names.
The command ncap2 -f
shows the complete list of methods available
on your build.
n2=sin(theta) n2=theta.sin() n2=sin(theta)^2 + cos(theta)^2 n2=theta.sin().pow(2) + theta.cos()^2
This statement chains methods together to convert three_dmn_var_sht to type double, average it, then convert this back to type short:
three_avg=three_dmn_var_sht.double().avg().short();
Aggregate Methods
avg()
sqravg()
avgsqr()
max()
min()
rms()
rmssdn()
ttl() or total()
// Average a variable over time four_time_avg=four_dmn_rec_var($time);
Packing Methods
pack() & pack_short()
NC_SHORT
pack_byte()
NC_BYTE
pack_short()
NC_SHORT
pack_int()
NC_INT
unpack()
Basic Methods
These methods work with variables and attributes. They have no arguments
size()
ndims()
type()
Utility Methods
set_miss(expr)
change_miss(expr)
get_miss()
delete_miss()
ram_write()
ram_delete()
PDQ Methods
reverse(dim args)
permute(dim args)
lat_2D_rrg_new=lat_2D_rrg.permute($lon,$lat).reverse($lon); lat_2D_rrg_new=0,90,-30,30,-30,30,-90,0
Type Conversion Methods
byte()
NC_BYTE
, a signed 1-byte integer
char()
NC_CHAR
, an ISO/ASCII character
short()
NC_SHORT
, a signed 2-byte integer
int()
NC_INT
, a signed 4-byte integer
float()
NC_FLOAT
, a single-precision (4-byte) floating point number
double()
NC_DOUBLE
, a double-precision (8-byte) floating point number
ubyte()
NC_UBYTE
, an unsigned 1-byte integer
ushort()
NC_USHORT
, an unsigned 2-byte integer
uint()
NC_UINT
, an unsigned 4-byte integer
int64()
NC_INT64
, a signed 8-byte integer
uint64()
NC_UINT64
, an unsigned 8-byte integer
Intrinsic Mathematical Methods
The list of mathematical methods is system dependant.
For the full list see Intrinsic mathematical methods
All the mathematical methods take a single operand ,with the exception of atan2
and pow
which take two.
If the operand type is less than float then the result will be of type float. If the operand is type double then the result will be type double. Like the other methods, you are free to use the mathematical methods as functions.
n1=pow(2,3.0f) // n1 type float n2=atan2(2,3.0) // n2 type double n3=1/(three_dmn_var_dbl.cos().pow(2))-tan(three_dmn_var_dbl)^2; // n3 type double