ocssw
V2022
|
#include <netcdf.h>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string.h>
#include <unistd.h>
#include <dfutils.h>
#include <genutils.h>
#include <l12_parms.h>
#include <l2_flags.h>
#include "l2extract.h"
#include "l2extract_3d_wv.h"
Go to the source code of this file.
Macros | |
#define | MAX_VARIABLES 512 |
#define | NCDIE(function) |
#define | GEOBOX_INC 20.0 |
Functions | |
void | copyGlobalAttributes (int ncid_r, int ncid_w) |
void | copyVariableAttributes (int ncid_r, int varid_r, int ncid_w, int varid_w) |
int | checkIfInProdlist (const char *prodlist, const char *name) |
void | set_attributes (const char *name, int ncid_r, int ncid_w, int varid_r, int *varid_w, int *dimIds, size_t *chunkSize, int *deflateLevel, int *shuffle, int *numAtts, size_t *chunkNelems, float *chunkPreemption, int *deflate, size_t *typeSize, int *numDims, nc_type *xtype) |
void | copyVariable (int ncid_r, const char *name, size_t *start, size_t *count, int *dimIds, int ncid_w, void *data) |
void | copyVariableSelectedIndexes (int ncid_r, const char *name, size_t *start, size_t *count, int *dimIds, int ncid_w, void *data, int *indexes, int dim_of_indexes) |
int | extractNetCDF (const char *infile, const char *outfile, int spix, int epix, int sscan, int escan, const char *prodlist, const char *wavelist) |
Macro Definition Documentation
◆ GEOBOX_INC
#define GEOBOX_INC 20.0 |
◆ MAX_VARIABLES
#define MAX_VARIABLES 512 |
Definition at line 23 of file l2extract_netcdf.c.
◆ NCDIE
#define NCDIE | ( | function | ) |
Definition at line 25 of file l2extract_netcdf.c.
Function Documentation
◆ checkIfInProdlist()
Definition at line 62 of file l2extract_netcdf.c.
◆ copyGlobalAttributes()
void copyGlobalAttributes | ( | int | ncid_r, |
int | ncid_w | ||
) |
Definition at line 37 of file l2extract_netcdf.c.
◆ copyVariable()
void copyVariable | ( | int | ncid_r, |
const char * | name, | ||
size_t * | start, | ||
size_t * | count, | ||
int * | dimIds, | ||
int | ncid_w, | ||
void * | data | ||
) |
copy a piece of a variable and all of it's attributes to another file
- Parameters
-
ncid_r netCDF file or group to read name name of the variable start location to start copying from count how many of each dimension to copy dimIds dimension IDs from the destination file to attach to the new variable ncid_w netCDF file or group to write the variable to data write this data to the new variable or copy from read variable if NULL
Definition at line 131 of file l2extract_netcdf.c.
◆ copyVariableAttributes()
void copyVariableAttributes | ( | int | ncid_r, |
int | varid_r, | ||
int | ncid_w, | ||
int | varid_w | ||
) |
Definition at line 49 of file l2extract_netcdf.c.
◆ copyVariableSelectedIndexes()
void copyVariableSelectedIndexes | ( | int | ncid_r, |
const char * | name, | ||
size_t * | start, | ||
size_t * | count, | ||
int * | dimIds, | ||
int | ncid_w, | ||
void * | data, | ||
int * | indexes, | ||
int | dim_of_indexes | ||
) |
copy a piece of a variable and all of it's attributes to another file. Slicing is performed along a selected dimension defined by a set of indexes along the dimension
- Parameters
-
ncid_r netCDF file or group to read name name of the variable start location to start copying from count how many of each dimension to copy dimIds dimension IDs from the destination file to attach to the new variable ncid_w netCDF file or group to write the variable to data write this data to the new variable or copy from read variable if dim_of_indexes - index of the dimension along which slicing is performed. indexes indexes along the dimension to be selected for output NULL
Definition at line 200 of file l2extract_netcdf.c.
◆ extractNetCDF()
int extractNetCDF | ( | const char * | infile, |
const char * | outfile, | ||
int | spix, | ||
int | epix, | ||
int | sscan, | ||
int | escan, | ||
const char * | prodlist, | ||
const char * | wavelist | ||
) |
extract a L2 netCDF file
- Parameters
-
infile input file name outfile output file name spix start pixel (1 based) epix ending pixel (1 based) sscan start line (1 based) escan end line (1 based) prodlist product list, comma separated, empty string outputs all products
- Returns
- 0 = success
Definition at line 293 of file l2extract_netcdf.c.
◆ set_attributes()
void set_attributes | ( | const char * | name, |
int | ncid_r, | ||
int | ncid_w, | ||
int | varid_r, | ||
int * | varid_w, | ||
int * | dimIds, | ||
size_t * | chunkSize, | ||
int * | deflateLevel, | ||
int * | shuffle, | ||
int * | numAtts, | ||
size_t * | chunkNelems, | ||
float * | chunkPreemption, | ||
int * | deflate, | ||
size_t * | typeSize, | ||
int * | numDims, | ||
nc_type * | xtype | ||
) |
Copies all the attributes and chunking/compression properties.
- Parameters
-
name - name of the variable ncid_r - id of a nc input group ncid_w - id of a nc output group varid_r - id of a nc input variable varid_w - id of a nc output variable dimIds - ids of dimensions chunkSize - chunk size deflateLevel - deflation level shuffle - shuffle flag. it stores the first byte of all of a variable's values in the chunk contiguously, followed by all the second bytes, and so on. If the values are not all wildly different, this can make the data more easily compressible numAtts - number of attributs chunkNelems - The number of chunk slots in the raw data chunk cache hash table will be put here chunkPreemption - The preemption will be put here. The preemtion value is between 0 and 1 inclusive and indicates how much chunks that have been fully read are favored for preemption. A value of zero means fully read chunks are treated no differently than other chunks (the preemption is strictly LRU) while a value of one means fully read chunks are always preempted before other chunks deflate - True to turn on deflation for this variable. typeSize - type numDims - number of dimensions xtype - nc type of the variable.
Definition at line 103 of file l2extract_netcdf.c.