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 synatax 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) or n2=theta.sin() n2=sin(theta)^2 +cos(theta)^2 or n2=theta.sin().pow(2) + theta.cos()^2
The below statement converts three_dmn_var_sht to type double, finds the average, then converts this average 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
a 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 floating point number
double()
NC_DOUBLE
a double precision floating point number
ubyte()
NC_UBYTE
a unsigned 1 byte int
ushort()
NC_USHORT
a unsigned 2-byte int
uint()
NC_UINT
a unsigned 4-byte int
int64()
NC_INT64
a signed 8-byte int
uint64()
NC_UINT64
a unsigned 8-byte int *
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