OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
l2extract_netcdf.c File Reference
#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 dependency graph for l2extract_netcdf.c:

Go to the source code of this file.

Macros

#define MAX_VARIABLES   128
 
#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 copyVariable (int ncid_r, const char *name, size_t *start, size_t *count, int *dimIds, int ncid_w, void *data)
 
int extractNetCDF (const char *infile, const char *outfile, int spix, int epix, int sscan, int escan, const char *prodlist)
 

Macro Definition Documentation

◆ GEOBOX_INC

#define GEOBOX_INC   20.0

◆ MAX_VARIABLES

#define MAX_VARIABLES   128

Definition at line 22 of file l2extract_netcdf.c.

◆ NCDIE

#define NCDIE (   function)
Value:
{ \
int status = function; \
switch(status){ \
case NC_NOERR: break; \
default: printf("NetCDF error: file %s, line %d, %s\n", \
__FILE__, __LINE__, nc_strerror(status)); \
exit(1); \
} \
}

Definition at line 24 of file l2extract_netcdf.c.

Function Documentation

◆ checkIfInProdlist()

int checkIfInProdlist ( const char *  prodlist,
const char *  name 
)

Definition at line 59 of file l2extract_netcdf.c.

◆ copyGlobalAttributes()

void copyGlobalAttributes ( int  ncid_r,
int  ncid_w 
)

Definition at line 34 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_rnetCDF file or group to read
namename of the variable
startlocation to start copying from
counthow many of each dimension to copy
dimIdsdimension IDs from the destination file to attach to the new variable
ncid_wnetCDF file or group to write the variable to
datawrite this data to the new variable or copy from read variable if NULL

Definition at line 87 of file l2extract_netcdf.c.

◆ copyVariableAttributes()

void copyVariableAttributes ( int  ncid_r,
int  varid_r,
int  ncid_w,
int  varid_w 
)

Definition at line 46 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 
)

extract a L2 netCDF file

Parameters
infileinput file name
outfileoutput file name
spixstart pixel (1 based)
epixending pixel (1 based)
sscanstart line (1 based)
escanend line (1 based)
prodlistproduct list, comma separated, empty string outputs all products
Returns
0 = success

Definition at line 170 of file l2extract_netcdf.c.

int status
Definition: l1_czcs_hdf.c:32