|
| static char * | pds4_trim (const char *s) |
| |
| static char * | pds4_get_text (xmlNode *node) |
| |
| static xmlNode * | pds4_find_child (xmlNode *parent, const char *name) |
| |
| static int | pds4_att_exists (NCindex *list, const char *name) |
| |
| static int | pds4_add_att (NCindex *list, const char *name, const char *value) |
| |
| static int | pds4_type_to_nc_type (const char *pds4_type, nc_type *xtypep, size_t *type_sizep, int *endiannessp, char *type_name) |
| |
| static int | pds4_set_var_type (nc_type xtype, int endianness, size_t type_size, const char *type_name, NC_TYPE_INFO_T **typep) |
| |
| static int | pds4_add_area_atts (NC_GRP_INFO_T *grp, xmlNode *area) |
| |
| static int | pds4_add_leaf_atts (NC_GRP_INFO_T *grp, xmlNode *node) |
| |
| static int | pds4_axis_cmp (const void *a, const void *b) |
| |
| static int | pds4_read_array (NC_GRP_INFO_T *grp, xmlNode *array) |
| |
| static int | pds4_read_table (NC_GRP_INFO_T *grp, xmlNode *table) |
| |
| static int | pds4_read_file_area (NC_FILE_INFO_T *h5, NC_GRP_INFO_T *root_grp, xmlNode *file_area) |
| |
| static int | pds4_read_label (NC_FILE_INFO_T *h5, NC_PDS4_FILE_INFO_T *pds4_file) |
| |
| int | NC_PDS4_open (const char *path, int mode, int basepe, size_t *chunksizehintp, void *parameters, const NC_Dispatch *dispatch, int ncid) |
| |
| static void | pds4_free_var_info (NC_GRP_INFO_T *grp) |
| |
| int | NC_PDS4_close (int ncid, void *ignore) |
| |
| int | NC_PDS4_abort (int ncid) |
| |
| int | NC_PDS4_inq_format (int ncid, int *formatp) |
| |
| int | NC_PDS4_inq_format_extended (int ncid, int *formatp, int *modep) |
| |
| static int | pds4_resolve_data_path (const char *label_path, const char *data_filename, char *resolved) |
| |
| static void | pds4_byte_swap (void *buf, size_t elem_size, size_t nelems) |
| |
| static int | pds4_needs_swap (int endianness) |
| |
| int | NC_PDS4_get_vara (int ncid, int varid, const size_t *start, const size_t *count, void *value, nc_type memtype) |
| |
PDS4 User-Defined Format (UDF) dispatch layer.
Implements the NEP PDS4 reader. The PDS4 XML label is parsed with libxml2 and mapped into the netCDF-4 in-memory model (groups, dimensions, variables, attributes). Data reading via nc_get_vara() reads from the referenced binary or ASCII data files with automatic byte-order conversion.
Supported data objects:
- Array / Array_2D_Image (contiguous, row-major)
- Table_Binary (fixed-record, binary fields)
- Table_Character (fixed-record, ASCII fields)
- Table_Delimited (variable-record, ASCII fields)
netCDF Model Mapping
A PDS4 label file contains one or more File_Area_Observational elements, each referencing a separate binary or ASCII data file. The NEP PDS4 reader maps the label structure into the netCDF-4 in-memory model as follows:
- The XML label root → root group. Elements of
Identification_Area and Observation_Area become global string attributes on the root group.
- Each
File_Area_Observational → a child group of the root group, named from the File/file_name text content.
Array / Array_2D_Image inside a file area → netCDF dimensions created from the Axis_Array children (sorted ascending by sequence_number); each axis_name becomes the dimension name and elements its length; Last Index Fastest maps to C-order (fastest-varying index is rightmost). The array becomes a single netCDF variable in the child group, with type derived from Element_Array/data_type.
Table_Binary, Table_Character, Table_Delimited → a record dimension whose length comes from <records>; one netCDF variable per Field_Binary/Field_Character/Field_Delimited child, named from <name>, typed from <data_type>, with an optional units attribute from <unit>.
Byte-Order Handling
PDS4 specifies byte order per data object: MSB (Most Significant Byte first, big-endian) or LSB (Least Significant Byte first, little-endian). NEP records the byte order as NC_ENDIAN_BIG or NC_ENDIAN_LITTLE on each netCDF variable at open time. During data reading in NC_PDS4_get_vara(), elements are byte-swapped in-place when the file byte order differs from the host byte order. ASCII numeric fields (Table_Character, Table_Delimited) do not require byte-swapping; they are parsed directly via strtod() or strtoll().
Data File Resolution
Binary and text data files are referenced by filename only in the PDS4 label (the File/file_name element). NEP resolves each data filename relative to the directory that contains the XML label file, using pds4_resolve_data_path(). If the label has no directory component (i.e. it is in the current directory), the data file is also looked up in the current directory.
- Author
- Edward Hartnett
- Date
- 2026-07-08
- Copyright
- Intelligent Data Design, Inc. All rights reserved.