CommonDataFormat.jl

A Julia package for reading Common Data Format (CDF) files.

API Reference

CommonDataFormat.ADRType

Attribute Descriptor Record (ADR)

Contains a description of an attribute in a CDF. There will be one ADR per attribute. The ADRhead field of the ADR contains the file offset of the first ADR.

source
CommonDataFormat.ADRMethod
ADR(buf, offset, RecordSizeType)

Load an Attribute Descriptor Record from the buffer at the specified position.

source
CommonDataFormat.AEDRType
AEDR

Attribute g/r Entry Descriptor Record. Describes a global entry (for global attributes) or rVariable entry (for variable attributes).

source
CommonDataFormat.CDRType

CDF Descriptor Record (CDR) - the main file header record Contains version, encoding, format information, and pointer to GDR

source
CommonDataFormat.CDRMethod
CDR(buffer, pos, FieldSizeT)

Load a CDF Descriptor Record from the IO stream at the specified offset. This follows the CDF specification for CDR record structure.

source
CommonDataFormat.Epoch16Type
Epoch16

Picoseconds since Year 0 (01-Jan-0000 00:00:00.000.000.000.000) Represented as two doubles (seconds and picoseconds).

source
CommonDataFormat.GDRType

Global Descriptor Record (GDR) - contains global information about the CDF file Points to variable and attribute descriptor records

source
CommonDataFormat.GDRMethod
GDR(buffer::Vector{UInt8}, pos, FieldSizeT)

Load a Global Descriptor Record from the buffer at the specified offset.

source
CommonDataFormat.TT2000Type
TT2000

Nanoseconds since J2000 (01-Jan-2000 12:00:00.000.000.000) with leap seconds, represented as an 8-byte integer.

source
CommonDataFormat.VDRMethod
VDR(io::IO, FieldSizeT)

Load a Variable Descriptor Record from the IO stream at the specified offset.

source
CommonDataFormat.VXRMethod
VXR(source, offset, RecordSizeType)

Load a Variable Index Record from the source at the specified offset.

source
CommonDataFormat.rVDRMethod
rVDR(io::IO, FieldSizeT)

Load a Variable Descriptor Record from the IO stream at the specified offset.

source
CommonDataFormat.attribMethod
attrib(cdf::CDFDataset, attribute_name::String)

Retrieve all entries for a named attribute from the CDF file.

source
CommonDataFormat.decode_cdr_flagsMethod
decode_cdr_flags(flags::UInt32)

Decode the CDR flags field into individual boolean flags.

CDF Flags (from CDF specification):

  • Bit 0: Majority (1=row-major, 0=column-major)
  • Bit 1: File format (1=single-file, 0=multi-file)
  • Bit 2: Checksum used (1=checksum present, 0=no checksum)
  • Bit 3: MD5 checksum method (requires bit 2=1)
source
CommonDataFormat.load_attribute_entriesMethod
load_attribute_entries(buffer::Vector{UInt8}, adr, RecordSizeType, cdf_encoding) -> Vector{AttributeEntry}

Load all attribute entries for a given attribute from its AEDRs.

source
CommonDataFormat.vattribMethod
vattrib(cdf, varnum, name)

Optimized version that loads only the requested attribute for the given variable number. Much faster than loading all attributes when only one is needed.

source
CommonDataFormat.@read_be_fieldsMacro
@read_be_fields buffer pos T1 T2 ...

Unrolls sequential big-endian reads starting at pos within buffer. Returns a tuple of the parsed values and the updated position, mirroring read_be_i but without the runtime ntuple/offset bookkeeping.

Example

values, next = @read_be_fields buf pos UInt32 Int16
source