The following procedure defines a NAP
function sind() to be sin(angle in degrees):
% proc sind x {nap "sin(x / 180p-1)"}
% [nap "sind {0 30 90}"]; # Try it
0 0.5 1
The following procedure defines a NAP function giving zonal means from a matrix with latitude/longitude coordinate variables:
% proc zonal_mean matrix {
nap "latitude = coordinate_variable(matrix, 0)"
nap "longitude = coordinate_variable(matrix, 1)"
nap "a = area_on_globe(latitude, longitude)"
nap "sum(a * matrix, 1) / sum (a, 1)"
}
% pwd
/sol/home/dav480/tcl_nap/data
% nap "z = [nap_get net zht_r21.nc zht]"
::NAP::35-35
% nap "zm = zonal_mean(z)"
::NAP::201-201
% $zm a
::NAP::201-201 f64 MissingValue: NaN References: 1 Unit: (NULL)
Dimension 0 Size: 56 Name: latitude Coordinate-variable: ::NAP::47-47
Value:
2320.95 2270.02 2165.5 1940.87 1534.45 1004.65 ..
% plot_nao zm
.win0