OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
ice_mask.c File Reference
#include "l12_proto.h"
Include dependency graph for ice_mask.c:

Go to the source code of this file.

Macros

#define ICE_TYPE_OLD   0
 
#define ICE_TYPE_NSIDC   1
 
#define ICE_TYPE_OISST   2
 
#define NX   4096
 
#define NY   2048
 
#define NAMING_CONVENTION_REFERENCE   "http://nsidc.org/data/docs/daac/nsidc0051_gsfc_seaice.gd.html#namingconvention"
 
#define NROWS   448
 
#define NCOLS   304
 
#define SROWS   332
 
#define SCOLS   316
 
#define RE   6378.273 /* Earth's equatorial radius */
 
#define EC   0.081816153 /* Eccentricity */
 
#define E2   0.006693883 /* Eccentricity squared */
 
#define SLAT   70.0 /* Standard latitude */
 
#define CELL   25.0 /* Stereographic pixel dimension (km) */
 
#define NODATA   -1.0
 
#define COPYNAME(orig, copy)
 
#define READIT(file, handle, rows, cols, array)
 

Typedefs

typedef char ice_t[NX]
 
typedef unsigned char north_t[NCOLS]
 
typedef unsigned char south_t[SCOLS]
 

Functions

int ice_mask_init_old (char *file, int day, int32 sd_id)
 
char ice_mask_old (float lon, float lat)
 
float get_icefrac_old (float lon, float lat)
 
int ice_mask_init_nsidc_raw (char *file)
 
int ice_mask_init_monthly (char *file, int year, int day, int32 sd_id)
 
int ice_mask_init_daily (char *file, int year, int day, int32 sd_id)
 
float get_icefrac_nsidc (float lon, float lat)
 
char ice_mask_nsidc (float lon, float lat)
 
int ice_init_oisst (char *icefile)
 
float get_icefrac_oisst (float lon, float lat)
 
char ice_mask_oisst (float lon, float lat)
 
int ice_mask_init (char *file, int year, int day, float threshold)
 
char ice_mask (float lon, float lat)
 
float ice_fraction (float lon, float lat)
 

Macro Definition Documentation

◆ CELL

#define CELL   25.0 /* Stereographic pixel dimension (km) */

Definition at line 42 of file ice_mask.c.

◆ COPYNAME

#define COPYNAME (   orig,
  copy 
)
Value:
{ \
(copy) = (char *)strdup( orig ); \
if( (copy) == NULL ){ \
fprintf(stderr,"-E- %s line %d: Memory allocation error\n", \
__FILE__,__LINE__); \
exit(EXIT_FAILURE); \
} \
}

Definition at line 162 of file ice_mask.c.

◆ E2

#define E2   0.006693883 /* Eccentricity squared */

Definition at line 40 of file ice_mask.c.

◆ EC

#define EC   0.081816153 /* Eccentricity */

Definition at line 39 of file ice_mask.c.

◆ ICE_TYPE_NSIDC

#define ICE_TYPE_NSIDC   1

Definition at line 4 of file ice_mask.c.

◆ ICE_TYPE_OISST

#define ICE_TYPE_OISST   2

Definition at line 5 of file ice_mask.c.

◆ ICE_TYPE_OLD

#define ICE_TYPE_OLD   0

Definition at line 3 of file ice_mask.c.

◆ NAMING_CONVENTION_REFERENCE

#define NAMING_CONVENTION_REFERENCE   "http://nsidc.org/data/docs/daac/nsidc0051_gsfc_seaice.gd.html#namingconvention"

Definition at line 30 of file ice_mask.c.

◆ NCOLS

#define NCOLS   304

Definition at line 34 of file ice_mask.c.

◆ NODATA

#define NODATA   -1.0

Definition at line 43 of file ice_mask.c.

◆ NROWS

#define NROWS   448

Definition at line 33 of file ice_mask.c.

◆ NX

#define NX   4096

Definition at line 17 of file ice_mask.c.

◆ NY

#define NY   2048

Definition at line 18 of file ice_mask.c.

◆ RE

#define RE   6378.273 /* Earth's equatorial radius */

Definition at line 38 of file ice_mask.c.

◆ READIT

#define READIT (   file,
  handle,
  rows,
  cols,
  array 
)
Value:
{ \
if( ( (handle) = fopen((file),"rb")) == NULL ){ \
fprintf(stderr,"-E- %s line %d: Could not open file, \"%s\" .\n", \
__FILE__,__LINE__,(file)); \
perror(""); \
exit(EXIT_FAILURE); \
} \
if( fseek( (handle) ,300,SEEK_SET) == -1 ){ \
fprintf(stderr, \
"-E- %s line %d: Could not skip header of file, \"%s\" .\n", \
__FILE__,__LINE__,(file)); \
perror(""); \
exit(EXIT_FAILURE); \
} \
if( \
fread((array), sizeof(unsigned char), (rows)*(cols), handle) \
!= (rows)*(cols) \
){ \
fprintf(stderr,"-E- %s line %d: Error reading file, \"%s\" .\n", \
__FILE__,__LINE__,(file)); \
perror(""); \
exit(EXIT_FAILURE); \
} \
}

Definition at line 171 of file ice_mask.c.

◆ SCOLS

#define SCOLS   316

Definition at line 36 of file ice_mask.c.

◆ SLAT

#define SLAT   70.0 /* Standard latitude */

Definition at line 41 of file ice_mask.c.

◆ SROWS

#define SROWS   332

Definition at line 35 of file ice_mask.c.

Typedef Documentation

◆ ice_t

typedef char ice_t[NX]

Definition at line 20 of file ice_mask.c.

◆ north_t

typedef unsigned char north_t[NCOLS]

Definition at line 45 of file ice_mask.c.

◆ south_t

typedef unsigned char south_t[SCOLS]

Definition at line 48 of file ice_mask.c.

Function Documentation

◆ get_icefrac_nsidc()

float get_icefrac_nsidc ( float  lon,
float  lat 
)

Definition at line 502 of file ice_mask.c.

◆ get_icefrac_oisst()

float get_icefrac_oisst ( float  lon,
float  lat 
)

Definition at line 824 of file ice_mask.c.

◆ get_icefrac_old()

float get_icefrac_old ( float  lon,
float  lat 
)

Definition at line 154 of file ice_mask.c.

◆ ice_fraction()

float ice_fraction ( float  lon,
float  lat 
)

function to return the ice fraction

Parameters
lonlongitude of interest
latlatitude of interest
Returns
ice fraction coverage at this position (range of 0 to 1)

Definition at line 1018 of file ice_mask.c.

◆ ice_init_oisst()

int ice_init_oisst ( char *  icefile)

Definition at line 714 of file ice_mask.c.

◆ ice_mask()

char ice_mask ( float  lon,
float  lat 
)

Get the ice mask at this location. 1=ice, 0=water

Parameters
lonlongitude of interest
latlatitude of interest
Returns
1 if icefrac above ice threshold else return 0

Definition at line 993 of file ice_mask.c.

◆ ice_mask_init()

int ice_mask_init ( char *  file,
int  year,
int  day,
float  threshold 
)

Definition at line 900 of file ice_mask.c.

◆ ice_mask_init_daily()

int ice_mask_init_daily ( char *  file,
int  year,
int  day,
int32  sd_id 
)

Definition at line 392 of file ice_mask.c.

◆ ice_mask_init_monthly()

int ice_mask_init_monthly ( char *  file,
int  year,
int  day,
int32  sd_id 
)

Definition at line 246 of file ice_mask.c.

◆ ice_mask_init_nsidc_raw()

int ice_mask_init_nsidc_raw ( char *  file)

Definition at line 196 of file ice_mask.c.

◆ ice_mask_init_old()

int ice_mask_init_old ( char *  file,
int  day,
int32  sd_id 
)

Initialize the ice data using the given old ice HDF file. The data set has a bit for each month of the year.

Parameters
filename of the ice file
dayday of year
sd_idopened HDF file id
Returns
0=good, else error

Definition at line 75 of file ice_mask.c.

◆ ice_mask_nsidc()

char ice_mask_nsidc ( float  lon,
float  lat 
)

Definition at line 702 of file ice_mask.c.

◆ ice_mask_oisst()

char ice_mask_oisst ( float  lon,
float  lat 
)

Definition at line 882 of file ice_mask.c.

◆ ice_mask_old()

char ice_mask_old ( float  lon,
float  lat 
)

Definition at line 146 of file ice_mask.c.

#define NULL
Definition: decode_rs.h:63
no change in intended resolving MODur00064 Corrected handling of bad ephemeris attitude resolving resolving GSFcd00179 Corrected handling of fill values for[Sensor|Solar][Zenith|Azimuth] resolving MODxl01751 Changed to validate LUT version against a value retrieved from the resolving MODxl02056 Changed to calculate Solar Diffuser angles without adjustment for estimated post launch changes in the MODIS orientation relative to incidentally resolving defects MODxl01766 Also resolves MODxl01947 Changed to ignore fill values in SCI_ABNORM and SCI_STATE rather than treating them as resolving MODxl01780 Changed to use spacecraft ancillary data to recognise when the mirror encoder data is being set by side A or side B and to change calculations accordingly This removes the need for seperate LUTs for Side A and Side B data it makes the new LUTs incompatible with older versions of the and vice versa Also resolves MODxl01685 A more robust GRing algorithm is being which will create a non default GRing anytime there s even a single geolocated pixel in a granule Removed obsolete messages from seed file
Definition: HISTORY.txt:413
char * strdup(const char *)
void copy(double **aout, double **ain, int n)