ocssw
V2022
|
sstval_extract-main.c
Go to the documentation of this file.
46 "geospatial, having scan line and pixel as the only dimensions, are processed, outputting statistics "
48 { 0, 0, 0, OPTION_DOC, "Two sets of output files are created, one base file describing the extract as a whole, "
49 "located at <ofile> or, if not set, <ifile>" OFILE_DEFAULT_EXT ", and one file for each product requested, "
50 "located at <base>.<product>. If the file is ignored by the L2QC, the product files are omitted." },
56 { str(VALEXTRACT_ERR_NCFILE_INVALID) "=" expanded_str(VALEXTRACT_ERR_NCFILE_INVALID), 0, 0, OPTION_DOC,
57 "NetCDF file is fine but isn't in the format expected (doesn't have geospatial dimensions, etc)" },
103 arguments->val_extract_arguments->products[arguments->val_extract_arguments->product_count++] = argv;
121 static argpar sstval_extract_main_argpar = { options, parse_options, args_doc, doc, argpar_children };
177 fprintf(input->base_ofile_h, "versions=val_extract=%s sstval_extract-main=%s\n", val_extract_version(), argpar_program_version);
208 fprintf(ofile_h, "qual_check_distance_actual=%f\n", vincenty_distance(input->slat_orig, input->slon_orig, input->val_extract_arguments->start_lat, input->val_extract_arguments->start_lon) / 1000.);
232 fprintf(ofile_h, "%*s%s=%d", flag_i ? 1 : 0, "", file->flag_meanings[flag_i], region->flag_counts[flag_i]);
265 fprintf(attr_file_h, "%s=%s\n", attribute_names[att_i], shash_get(file->attributes, attribute_names[att_i]));
326 fprintf(output_h, "%s=%s\n", attribute_names[att_i], shash_get(var->attributes, attribute_names[att_i]));
384 if (lat[i] != -999 && qual[i] >= 0 && (var->region->pixel_flags[i] & input->val_extract_arguments->ignore_flags_mask) == 0) {
385 if (!(line < border_bottom || pixel < border_bottom || line > line_border_top || pixel > pixl_border_top)) {
387 if (distance <= max_distance && (qual[i] < best_quality || (qual[i] == best_quality && distance < closest_best_quality))) {
408 // printf("find_best: %f, %f (%f)\n", input->val_extract_arguments->start_lat, input->val_extract_arguments->start_lon, best_quality);
409 // printf("find_best distance: %f\n", vincenty_distance(input->val_extract_arguments->start_lat, input->val_extract_arguments->start_lon, var->region->lat, var->region->lon));
430 input->qual_check_data_copies[copy_location] = malloc(sizeof(double) * var->region->pixel_count);
431 memcpy(input->qual_check_data_copies[copy_location], var->data, sizeof(double) * var->region->pixel_count);
549 olog_crit(olog_default, "val-extract succeeded, a close-enough point was likely not found in file\n");
shash * products_printed
Definition: sstval_extract-main.c:28
int olog_crit(olog *olog,...)
Master structure containing options, document strings, child parsers, and text filters....
Definition: argpar.h:398
Definition: val_extract.h:253
Definition: val_extract.h:273
#define VALEXTRACT_ERR_FLAG
Returned when the something goes wrong processing l2_flags.
Definition: val_extract.h:37
Definition: val_extract.h:241
#define VALEXTRACT_KEY_SUCCESS
Passed to parser when the processing is finished and no errors were encountered.
Definition: val_extract.h:58
#define VALEXTRACT_ERR_POINT_NOT_FOUND
Returned when the desired point is not in the file boundaries.
Definition: val_extract.h:28
Definition: argpar.c:41
const char * argpar_program_version
Used as the program version string. If set, a version=1 option is automatically added....
Definition: sstval_extract-main.c:81
double ** qual_check_data_copies
Definition: sstval_extract-main.c:33
Provides a single function to calculate geographical distances.
Passed into the library function to control the processing. Many of the fields will be unspecified.
Definition: val_extract.h:103
double vincenty_distance(double lat1, double lon1, double lat2, double lon2)
Calculate geographical distances using Vincenty's algorithm.
Definition: vincenty.c:47
#define ARGPAR_KEY_ARG
This is not an option at all, but rather a command line argument. If a parser receiving this key retu...
Definition: argpar.h:271
Given to val_extract_arguments, these contain the valid ranges, inclusive, of variables....
Definition: val_extract.h:87
nc_var ** qual_check_var_copies
Definition: sstval_extract-main.c:32
int shash_set(shash *h, const char *key, const char *value)
Add or overwrite a pointer, associating it with the given key.
Definition: shash.c:224
#define ARGPAR_KEY_INIT
Passed as the key to each parser callback function before any parsing occurs. For most cases,...
Definition: argpar.h:287
const char * val_extract_version()
Returns a string representation of the library's version number, without a label.
Definition: val_extract.c:2632
#define VALEXTRACT_KEY_INIT
Passed to parser when beginning the processing.
Definition: val_extract.h:50
A simple logger, capable of dispatching log events to multiple end points.
struct packet_stats stats
int(* val_extract_parser)(int key, void *nc_input, void *user_input)
Pointer to a callback function to call for each argument parsed.
Definition: val_extract.h:79
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
#define ARGPAR_ERR_UNKNOWN
What to return for unrecognized keys within an argpar_parser function.
Definition: argpar.h:341
int state(double tjdTDB, JPLIntUtilType *util, double posvel[13][6], double *pnut)
const char * shash_get(shash *h, const char *key)
Find a pointer associated with the given string.
Definition: shash.c:205
#define VALEXTRACT_ERR_VARIABLE
Returned when the something goes wrong processing a product or when finding a product specified on th...
Definition: val_extract.h:40
#define VALEXTRACT_KEY_VAR
Passed to parser when a variable is processed. The parser is passed a pointer to an nc_var structure ...
Definition: val_extract.h:56
#define ARGPAR_ERR_ABORT
Returned from the parser callback to signal argpar to stop parsing and return to the caller.
Definition: argpar.h:334
int shash_next(shash *h, const char **key, const char **value)
Retrieves the next key-value pair in the shash. The order in which the pointers are returned shall be...
Definition: shash.c:283
int errno
int shash_rewind(shash *h)
Rewind iterator for traversing all the keys and values.
Definition: shash.c:277
this program makes no use of any feature of the SDP Toolkit that could generate such a then geolocation is calculated at that and then aggregated up to Resolved feature request Bug by adding three new int8 SDSs for each high resolution pixel
Definition: HISTORY.txt:192
int argpar_parse_args(argpar *p, unsigned argc, char *argv[], unsigned flags, unsigned *end_index, void *input)
Parse an array of key=value pairs and/or key arguments.
Definition: argpar.c:679
argpar val_extract_argpar
argpar structure used for making programs that inherit options from this library.
Definition: val_extract.c:523
#define OPTION_DOC
This option isn't actually an option, merely text for the usage summary.
Definition: argpar.h:152
#define VALEXTRACT_ERR_L2QC
Not a real error, but returned when the L2QC step says it's a poor quality file.
Definition: val_extract.h:44
State variable to be filled before each call to the parser callback.
Definition: argpar.h:196
A simple dictionary library for storing strings.
int argpar_usage_default(argpar *argpar)
Print the default usage summary with all available sections.
Definition: argpar-help.c:509
#define VALEXTRACT_UNSET
Initial value for location arguments (lat/lon/line/pixl) before argument parsing.
Definition: val_extract.h:68
#define VALEXTRACT_ERR_NCFILE_INVALID
Returned when the NetCDF file isn't in the format expected (not an L2, etc).
Definition: val_extract.h:35
Library for reading command-line arguments in the form of key=value.
Definition: val_extract.h:266
Process a small section of a Level-2 NetCDF file.
int val_extract(val_extract_arguments *arguments)
Process a small section of a Level-2 NetCDF file.
Definition: val_extract.c:589
double qual_check_distance
Definition: sstval_extract-main.c:31
val_extract_arguments * val_extract_arguments
Definition: sstval_extract-main.c:35
#define VALEXTRACT_ERR_NCFILE_ERR
Returned when the NetCDF file can't be opened (due to errors or corruption).
Definition: val_extract.h:33
int val_extract_clean(val_extract_arguments *arguments)
Clean up stuff malloc'd by the argpar callback. Should be called at the end of processing if val_extr...
Definition: val_extract.c:2540
#define VALEXTRACT_ERR_UNKNOWN
Returned for unexpected errors like malloc failures or, possibly, permissions problems and the like.
Definition: val_extract.h:31
#define VALEXTRACT_KEY_FILE
Passed to parser when first opening the NetCDF file. The parser is passed a pointer to an nc_region s...
Definition: val_extract.h:53
void val_extract_clear_args(val_extract_arguments *arguments)
Clear an argument struct to make it suitable for using the library without using argpar.
Definition: val_extract.c:127
How many dimensions is the output array Default is Not sure if anything above will work correctly strcpy(l2prod->title, "no title yet")
#define VALEXTRACT_KEY_ERROR
Passed to parser when the processing is finished and an error was encountered.
Definition: val_extract.h:60
#define OPTION_DBL
Cast this option as a double. The value and any error will be reflected in the argpar_state struct du...
Definition: argpar.h:156