Mask points in a variable given a mask field. More...
#include <utils.h>
Go to the source code of this file.
Functions | |
void | mask_points (double *buffer, double missing_value, short int *mask, int nlon, int nlat, int ndim) |
Mask points in a variable given a mask field. |
Mask points in a variable given a mask field.
Definition in file mask_points.c.
void mask_points | ( | double * | buffer, | |
double | missing_value, | |||
short int * | mask, | |||
int | nlon, | |||
int | nlat, | |||
int | ndim | |||
) |
Mask points in a variable given a mask field.
[out] | buffer | 3D buffer |
[in] | missing_value | Missing value |
[in] | mask | Mask 2D array |
[in] | nlon | Longitude dimension length |
[in] | nlat | Latitude dimension length |
[in] | ndim | Third dimension length |
Definition at line 58 of file mask_points.c.
Referenced by wt_learning().
00058 { 00068 int i; /* Loop counter */ 00069 int j; /* Loop counter */ 00070 int t; /* Time loop counter */ 00071 00072 (void) printf("%s: Masking points.\n", __FILE__); 00073 00074 /* Loop over all gridpoints */ 00075 00076 /* Loop over latitudes */ 00077 for (j=0; j<nlat; j++) { 00078 /* Loop over longitudes */ 00079 for (i=0; i<nlon; i++) { 00080 /* Mask gridpoints if mask is not 1 */ 00081 if (mask[i+j*nlon] != 1) { 00082 /* Loop over last dimension to assign missing value for this gridpoint */ 00083 for (t=0; t<ndim; t++) 00084 buffer[i+j*nlon+t*nlon*nlat] = missing_value; 00085 } 00086 } 00087 } 00088 }