NEP 4.3.0
NetCDF Expansion Pack
Loading...
Searching...
No Matches
fitsfile.c File Reference

FITS User-Defined Format (UDF) dispatch layer. More...

#include "config.h"
#include <stdlib.h>
#include <string.h>
#include "nep_nc4.h"
#include "fitsinternal.h"

Functions

static int map_fitsio_error (int status)
int nc4_var_list_add (NC_GRP_INFO_T *grp, const char *name, int ndims, NC_VAR_INFO_T **var)
static int nc4_set_var_type (nc_type xtype, int endianness, size_t type_size, char *type_name, NC_TYPE_INFO_T **typep)
static int nc4_var_list_add_full (NC_GRP_INFO_T *grp, const char *name, int ndims, nc_type xtype, int endianness, size_t type_size, char *type_name, void *fill_value, int contiguous, size_t *chunksizes, void *format_var_info, NC_VAR_INFO_T **var)
int NC_FITS_open (const char *path, int mode, int basepe, size_t *chunksizehintp, void *parameters, const NC_Dispatch *dispatch, int ncid)
int NC_FITS_close (int ncid, void *ignore)
int NC_FITS_abort (int ncid)
int NC_FITS_inq_format (int ncid, int *formatp)
int NC_FITS_inq_format_extended (int ncid, int *formatp, int *modep)
int NC_FITS_get_vara (int ncid, int varid, const size_t *start, const size_t *count, void *value, nc_type memtype)

Detailed Description

FITS User-Defined Format (UDF) dispatch layer.

Implements the NEP FITS reader, which maps NASA/ESA Flexible Image Transport System (FITS) files to the netCDF-4 data model via CFITSIO.

  • Primary HDU: image variable in the root group; BITPIX mapped to nc_type; standard keywords (BUNIT, BSCALE, BZERO, BLANK) mapped to attributes.
  • Extension HDUs: each becomes a child group named from EXTNAME. ASCII/binary table HDUs: row dimension + one variable per column. Image extension HDUs: same dim/var/attribute mapping as the primary HDU.
  • Data reading: NC_FITS_get_vara() calls fits_read_subset() for image variables and fits_read_col() for table columns. Dimension order is reversed (FITS column-major <-> netCDF row-major). CFITSIO applies BSCALE/BZERO scaling automatically.
Author
Edward Hartnett
Date
2026-06-29

Function Documentation

◆ map_fitsio_error()

int map_fitsio_error ( int status)
static

◆ nc4_set_var_type()

int nc4_set_var_type ( nc_type xtype,
int endianness,
size_t type_size,
char * type_name,
NC_TYPE_INFO_T ** typep )
static

◆ nc4_var_list_add()

int nc4_var_list_add ( NC_GRP_INFO_T * grp,
const char * name,
int ndims,
NC_VAR_INFO_T ** var )
extern

◆ nc4_var_list_add_full()

int nc4_var_list_add_full ( NC_GRP_INFO_T * grp,
const char * name,
int ndims,
nc_type xtype,
int endianness,
size_t type_size,
char * type_name,
void * fill_value,
int contiguous,
size_t * chunksizes,
void * format_var_info,
NC_VAR_INFO_T ** var )
static

◆ NC_FITS_abort()

int NC_FITS_abort ( int ncid)

◆ NC_FITS_close()

int NC_FITS_close ( int ncid,
void * ignore )

◆ NC_FITS_get_vara()

int NC_FITS_get_vara ( int ncid,
int varid,
const size_t * start,
const size_t * count,
void * value,
nc_type memtype )

◆ NC_FITS_inq_format()

int NC_FITS_inq_format ( int ncid,
int * formatp )

◆ NC_FITS_inq_format_extended()

int NC_FITS_inq_format_extended ( int ncid,
int * formatp,
int * modep )

◆ NC_FITS_open()

int NC_FITS_open ( const char * path,
int mode,
int basepe,
size_t * chunksizehintp,
void * parameters,
const NC_Dispatch * dispatch,
int ncid )