CommonDataFormat.jl
A Julia package for reading Common Data Format (CDF) files.
API Reference
CommonDataFormat.ADR
CommonDataFormat.ADR
CommonDataFormat.AEDR
CommonDataFormat.CDFDataset
CommonDataFormat.CDR
CommonDataFormat.CDR
CommonDataFormat.Epoch
CommonDataFormat.Epoch16
CommonDataFormat.GDR
CommonDataFormat.GDR
CommonDataFormat.Header
CommonDataFormat.TT2000
CommonDataFormat.VDR
CommonDataFormat.VDR
CommonDataFormat.VVR
CommonDataFormat.VXR
CommonDataFormat.VXR
CommonDataFormat.rVDR
CommonDataFormat.attrib
CommonDataFormat.attrib
CommonDataFormat.attribnames
CommonDataFormat.decode_cdr_flags
CommonDataFormat.is_big_endian_encoding
CommonDataFormat.is_cdf_v3
CommonDataFormat.is_nrv
CommonDataFormat.load_attribute_entries
CommonDataFormat.read_uint32_be
CommonDataFormat.vattrib
CommonDataFormat.vattrib
CommonDataFormat.@read_be_fields
CommonDataFormat.ADR
— TypeAttribute 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.
CommonDataFormat.ADR
— MethodADR(buf, offset, RecordSizeType)
Load an Attribute Descriptor Record from the buffer at the specified position.
CommonDataFormat.AEDR
— TypeAEDR
Attribute g/r Entry Descriptor Record. Describes a global entry (for global attributes) or rVariable entry (for variable attributes).
CommonDataFormat.CDFDataset
— MethodCDFDataset(filename)
Load a CDF file and return a CDFDataset object.
Example
cdf = CDFDataset("data.cdf")
CommonDataFormat.CDR
— TypeCDF Descriptor Record (CDR) - the main file header record Contains version, encoding, format information, and pointer to GDR
CommonDataFormat.CDR
— MethodCDR(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.
CommonDataFormat.Epoch
— TypeEpoch
Milliseconds since Year 0 (01-Jan-0000 00:00:00.000) Represented as a single double.
CommonDataFormat.Epoch16
— TypeEpoch16
Picoseconds since Year 0 (01-Jan-0000 00:00:00.000.000.000.000) Represented as two doubles (seconds and picoseconds).
CommonDataFormat.GDR
— TypeGlobal Descriptor Record (GDR) - contains global information about the CDF file Points to variable and attribute descriptor records
CommonDataFormat.GDR
— MethodGDR(buffer::Vector{UInt8}, pos, FieldSizeT)
Load a Global Descriptor Record from the buffer at the specified offset.
CommonDataFormat.Header
— TypeCDF Record header structure - common to all record types
CommonDataFormat.TT2000
— TypeTT2000
Nanoseconds since J2000 (01-Jan-2000 12:00:00.000.000.000) with leap seconds, represented as an 8-byte integer.
CommonDataFormat.VDR
— TypeVariable Descriptor Record (VDR) - describes a single variable
CommonDataFormat.VDR
— MethodVDR(io::IO, FieldSizeT)
Load a Variable Descriptor Record from the IO stream at the specified offset.
CommonDataFormat.VVR
— TypeVariable Value Record (VVR) - contains actual variable data
CommonDataFormat.VXR
— TypeVariable Index Record (VXR) - contains pointers to variable data records
CommonDataFormat.VXR
— MethodVXR(source, offset, RecordSizeType)
Load a Variable Index Record from the source at the specified offset.
CommonDataFormat.rVDR
— MethodrVDR(io::IO, FieldSizeT)
Load a Variable Descriptor Record from the IO stream at the specified offset.
CommonDataFormat.attrib
— Methodattrib(cdf::CDFDataset, attribute_name::String)
Retrieve all entries for a named attribute from the CDF file.
CommonDataFormat.attrib
— Methodattrib(cdf::CDFDataset)
Load all attributes from the CDF file.
CommonDataFormat.attribnames
— Methodattribnames(cdf::CDFDataset)
Return a list of attribute names in the CDF file.
CommonDataFormat.decode_cdr_flags
— Methoddecode_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)
CommonDataFormat.is_big_endian_encoding
— Methodis_big_endian_encoding(encoding)
Determine if a CDF encoding uses big-endian byte order based on CDF specification encoding values.
CommonDataFormat.is_cdf_v3
— Methodis_cdf_v3(magic_bytes)
Determine if this is a CDF v3 file based on the magic number.
CommonDataFormat.is_nrv
— MethodWhether or not the variable is a non-record variable
CommonDataFormat.load_attribute_entries
— Methodload_attribute_entries(buffer::Vector{UInt8}, adr, RecordSizeType, cdf_encoding) -> Vector{AttributeEntry}
Load all attribute entries for a given attribute from its AEDRs.
CommonDataFormat.read_uint32_be
— Methodread_uint32_be(io::IO)
Read a 32-bit unsigned integer in big-endian byte order. CDF format uses big-endian for record fields.
CommonDataFormat.vattrib
— Methodvattrib(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.
CommonDataFormat.vattrib
— Methodvattrib(cdf::CDFDataset, varnum::Integer)
Get all variable attributes for a specific variable number.
CommonDataFormat.@read_be_fields
— Macro@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