ocssw V2020
l1_hmodis_hdf.c File Reference
#include "libnav.h"
#include "hdf4utils.h"
#include "l12_proto.h"
Include dependency graph for l1_hmodis_hdf.c:

Go to the source code of this file.

Classes

struct  sdslist
 
struct  modis_file
 
struct  modis_sds
 
struct  bandinfo
 
struct  sfcorr_table
 
struct  fill_table
 

Macros

#define _XOPEN_SOURCE_EXTENDED   /* for strdup() */
 
#define SCAN_TIME_INTERVAL   1.4771
 
#define TRYMEM(file, line, memstat)
 
#define MIN_BAD_SI   65500
 
#define MAX_ATTERR   0.017453293 /* radians, ~= 1 degree */
 
#define LOOPI   for (i = 0; i < nvals; i++)
 

Enumerations

enum  REF_SDS {
  GEO_TAISEC, GEO_MSIDE, GEO_ANGLES, GEO_MNORM,
  REF_NUM_SDS
}
 
enum  GEO_SDS {
  GEO_LON, GEO_LAT, GEO_HGT, GEO_SOLZ,
  GEO_SOLA, GEO_SENZ, GEO_SENA, GEO_NUM_SDS
}
 
enum  GEO_COEFFS { GEO_SCALE, GEO_NUM_COEFFS }
 
enum  L1B_SDS {
  RSB_250, RSB_500, RSB_1KM, CIR_1KM,
  TEB_1KM, L1B_NUM_SDS
}
 
enum  L1B_COEFFS {
  REFL_SCALE, REFL_OFFSET, RAD_SCALE, RAD_OFFSET,
  L1B_NUM_COEFFS
}
 

Functions

int modpath_1km (const char *oldpath, const char *newchars, char *newpath)
 
int open_modis_l1bfile (modis_file *l1bfile)
 
int init_l1b (const char filename[FILENAME_MAX], int32_t *max_resolution)
 
int open_modis_geofile (modis_file *geofile)
 
int init_geo (const char filename[FILENAME_MAX])
 
int read_sds_1scan (sds_struct *sds, int32_t iscan, int32_t scandim, int32_t per_scan)
 
int openl1_hmodis_hdf (filehandle *l1file)
 
int alloc_scan (const int32_t nvals)
 
void read_sfcorrtables (sfcorr_table *sfcorr, int32_t sensorID)
 
void subframe_correction (const int32_t sensorID, const int32_t iband, const modis_sds mds, double *data)
 
void init_detfill (fill_table *fill)
 
void fill_dead_detectors (const int32_t iband, const modis_sds mds, double *data)
 
double interp_bilin (double val[4], double dx, double dy)
 
double interp_modis_EVdata (double val[4], double dx, double dy)
 
double interp_modis_Longitude (double val[4], double dx, double dy)
 
int modis_interp (const modis_sds s, const int32_t sdsband, const int32_t newres, double *olddata, double *newdata)
 
int load_modis_scan (const int32_t iscan, const int32_t resolution, int32_t sensorID)
 
int set_l1rec_scanvals (const int32_t iscan, l1str *l1rec)
 
int readl1_hmodis_hdf (filehandle *l1file, const int32_t line, l1str *l1rec)
 
int closel1_hmodis_hdf ()
 
int readl1_lonlat_hmodis_hdf (filehandle *l1file, int32_t line, l1str *l1rec)
 

Variables

double(* interp_modis_var )(double val[4], double dx, double dy)
 

Macro Definition Documentation

◆ _XOPEN_SOURCE_EXTENDED

#define _XOPEN_SOURCE_EXTENDED   /* for strdup() */

Definition at line 11 of file l1_hmodis_hdf.c.

◆ LOOPI

#define LOOPI   for (i = 0; i < nvals; i++)

Definition at line 523 of file l1_hmodis_hdf.c.

◆ MAX_ATTERR

#define MAX_ATTERR   0.017453293 /* radians, ~= 1 degree */

Definition at line 522 of file l1_hmodis_hdf.c.

◆ MIN_BAD_SI

#define MIN_BAD_SI   65500

Definition at line 521 of file l1_hmodis_hdf.c.

◆ SCAN_TIME_INTERVAL

#define SCAN_TIME_INTERVAL   1.4771

Definition at line 17 of file l1_hmodis_hdf.c.

◆ TRYMEM

#define TRYMEM (   file,
  line,
  memstat 
)
Value:
{ \
if (memstat == NULL) { \
fprintf(stderr, \
"-E- %s line %d: Memory allocation error.\n", \
file, line); \
exit(1); } \
}

Definition at line 20 of file l1_hmodis_hdf.c.

Enumeration Type Documentation

◆ GEO_COEFFS

enum GEO_COEFFS
Enumerator
GEO_SCALE 

scale_factor

GEO_NUM_COEFFS 

last entry = number of scale attributes

Definition at line 74 of file l1_hmodis_hdf.c.

◆ GEO_SDS

enum GEO_SDS
Enumerator
GEO_LON 

Longitude

GEO_LAT 

Latitude

GEO_HGT 

Height

GEO_SOLZ 

SolarZenith

GEO_SOLA 

SolarAzimuth

GEO_SENZ 

SensorZenith

GEO_SENA 

SensorAzimuth

GEO_NUM_SDS 

last entry = number of SDSs

Definition at line 53 of file l1_hmodis_hdf.c.

◆ L1B_COEFFS

enum L1B_COEFFS
Enumerator
REFL_SCALE 

reflectance_scales

REFL_OFFSET 

reflectance_offsets

RAD_SCALE 

radiance_scales

RAD_OFFSET 

radiance_offsets

L1B_NUM_COEFFS 

last entry = number of scale attributes

Definition at line 109 of file l1_hmodis_hdf.c.

◆ L1B_SDS

enum L1B_SDS
Enumerator
RSB_250 

Bands 1 & 2

RSB_500 

Bands 3 - 7

RSB_1KM 

all other reflective bands

CIR_1KM 

Band 26

TEB_1KM 

all thermal bands

L1B_NUM_SDS 

last entry = number of SDSs

Definition at line 83 of file l1_hmodis_hdf.c.

◆ REF_SDS

enum REF_SDS
Enumerator
GEO_TAISEC 

EV start time

GEO_MSIDE 

Mirror side

GEO_ANGLES 

attitude_angles

GEO_MNORM 

T_inst2ECR

REF_NUM_SDS 

last entry = number of SDSs

Definition at line 37 of file l1_hmodis_hdf.c.

Function Documentation

◆ alloc_scan()

int alloc_scan ( const int32_t  nvals)

Allocates memory for global structure "scan", and initializes some constants

Parameters
[in]nvalsnumber of values per variable per scan
Returns

Definition at line 755 of file l1_hmodis_hdf.c.

◆ closel1_hmodis_hdf()

int closel1_hmodis_hdf ( )
Returns

Definition at line 1616 of file l1_hmodis_hdf.c.

◆ fill_dead_detectors()

void fill_dead_detectors ( const int32_t  iband,
const modis_sds  mds,
double *  data 
)

Definition at line 1023 of file l1_hmodis_hdf.c.

◆ init_detfill()

void init_detfill ( fill_table fill)

Definition at line 967 of file l1_hmodis_hdf.c.

◆ init_geo()

int init_geo ( const char  filename[FILENAME_MAX])

Definition at line 429 of file l1_hmodis_hdf.c.

◆ init_l1b()

int init_l1b ( const char  filename[FILENAME_MAX],
int32_t *  max_resolution 
)

Definition at line 272 of file l1_hmodis_hdf.c.

◆ interp_bilin()

double interp_bilin ( double  val[4],
double  dx,
double  dy 
)

Definition at line 1096 of file l1_hmodis_hdf.c.

◆ interp_modis_EVdata()

double interp_modis_EVdata ( double  val[4],
double  dx,
double  dy 
)

Definition at line 1101 of file l1_hmodis_hdf.c.

◆ interp_modis_Longitude()

double interp_modis_Longitude ( double  val[4],
double  dx,
double  dy 
)

Definition at line 1135 of file l1_hmodis_hdf.c.

◆ load_modis_scan()

int load_modis_scan ( const int32_t  iscan,
const int32_t  resolution,
int32_t  sensorID 
)

load values for one scan

Parameters
[in]iscan
Returns

Definition at line 1260 of file l1_hmodis_hdf.c.

◆ modis_interp()

int modis_interp ( const modis_sds  s,
const int32_t  sdsband,
const int32_t  newres,
double *  olddata,
double *  newdata 
)

Definition at line 1158 of file l1_hmodis_hdf.c.

◆ modpath_1km()

int modpath_1km ( const char *  oldpath,
const char *  newchars,
char *  newpath 
)

Definition at line 179 of file l1_hmodis_hdf.c.

◆ open_modis_geofile()

int open_modis_geofile ( modis_file geofile)

Definition at line 391 of file l1_hmodis_hdf.c.

◆ open_modis_l1bfile()

int open_modis_l1bfile ( modis_file l1bfile)

Definition at line 215 of file l1_hmodis_hdf.c.

◆ openl1_hmodis_hdf()

int openl1_hmodis_hdf ( filehandle *  l1file)
Parameters
[in,out]l1file
Returns

Definition at line 599 of file l1_hmodis_hdf.c.

◆ read_sds_1scan()

int read_sds_1scan ( sds_struct *  sds,
int32_t  iscan,
int32_t  scandim,
int32_t  per_scan 
)

Definition at line 474 of file l1_hmodis_hdf.c.

◆ read_sfcorrtables()

void read_sfcorrtables ( sfcorr_table sfcorr,
int32_t  sensorID 
)

Definition at line 787 of file l1_hmodis_hdf.c.

◆ readl1_hmodis_hdf()

int readl1_hmodis_hdf ( filehandle *  l1file,
const int32_t  line,
l1str *  l1rec 
)
Parameters
[in,out]l1file
[in]line
[in,out]l1rec
Returns

Definition at line 1433 of file l1_hmodis_hdf.c.

◆ readl1_lonlat_hmodis_hdf()

int readl1_lonlat_hmodis_hdf ( filehandle *  l1file,
int32_t  line,
l1str *  l1rec 
)

Definition at line 1655 of file l1_hmodis_hdf.c.

◆ set_l1rec_scanvals()

int set_l1rec_scanvals ( const int32_t  iscan,
l1str *  l1rec 
)

set all scan-based values in l1rec

Parameters
[in]iscan
[in,out]l1rec
Returns

Definition at line 1373 of file l1_hmodis_hdf.c.

◆ subframe_correction()

void subframe_correction ( const int32_t  sensorID,
const int32_t  iband,
const modis_sds  mds,
double *  data 
)

Definition at line 900 of file l1_hmodis_hdf.c.

Variable Documentation

◆ allbands

float* allbands

Scaled Integers for all bands

Definition at line 747 of file l1_hmodis_hdf.c.

◆ angles

double angles[3]

attitude_angles

Definition at line 738 of file l1_hmodis_hdf.c.

◆ hgt

float* hgt

Height

Definition at line 742 of file l1_hmodis_hdf.c.

◆ interp_modis_var

double(* interp_modis_var) (double val[4], double dx, double dy)

Definition at line 1156 of file l1_hmodis_hdf.c.

◆ iscan

int32_t iscan

scan number (0-based)

Definition at line 730 of file l1_hmodis_hdf.c.

◆ lat

float* lat

Latitude

Definition at line 741 of file l1_hmodis_hdf.c.

◆ lon

float* lon

Longitude

Definition at line 740 of file l1_hmodis_hdf.c.

◆ mnorm

double mnorm[3]

T_inst2ECR (need only 1st 3 values)

Definition at line 739 of file l1_hmodis_hdf.c.

◆ mside

int32_t mside

Mirror side

Definition at line 737 of file l1_hmodis_hdf.c.

◆ nbands

int32_t nbands

number of bands

Definition at line 733 of file l1_hmodis_hdf.c.

◆ npix

int32_t npix

number of values per variable per line

Definition at line 732 of file l1_hmodis_hdf.c.

◆ nvals

int32_t nvals

number of values per variable per scan

Definition at line 731 of file l1_hmodis_hdf.c.

◆ sena

float* sena

SensorAzimuth

Definition at line 746 of file l1_hmodis_hdf.c.

◆ senz

float* senz

SensorZenith

Definition at line 745 of file l1_hmodis_hdf.c.

◆ sola

float* sola

SolarAzimuth

Definition at line 744 of file l1_hmodis_hdf.c.

◆ solz

float* solz

SolarZenith

Definition at line 743 of file l1_hmodis_hdf.c.

◆ taisec

double taisec

EV start time

Definition at line 736 of file l1_hmodis_hdf.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