pub struct Nc4File { /* private fields */ }Expand description
An opened NetCDF-4 file (backed by HDF5).
Implementations§
Source§impl Nc4File
impl Nc4File
Sourcepub fn open_with_options(path: &Path, options: NcOpenOptions) -> Result<Self>
pub fn open_with_options(path: &Path, options: NcOpenOptions) -> Result<Self>
Open a NetCDF-4 file from disk with custom options.
Sourcepub fn from_bytes(data: &[u8]) -> Result<Self>
pub fn from_bytes(data: &[u8]) -> Result<Self>
Open a NetCDF-4 file from in-memory bytes.
Sourcepub fn from_bytes_with_options(
data: &[u8],
options: NcOpenOptions,
) -> Result<Self>
pub fn from_bytes_with_options( data: &[u8], options: NcOpenOptions, ) -> Result<Self>
Open a NetCDF-4 file from in-memory bytes with custom options.
Sourcepub fn from_storage(storage: DynStorage) -> Result<Self>
pub fn from_storage(storage: DynStorage) -> Result<Self>
Open a NetCDF-4 file from a custom random-access storage backend.
Sourcepub fn from_storage_with_options(
storage: DynStorage,
options: NcOpenOptions,
) -> Result<Self>
pub fn from_storage_with_options( storage: DynStorage, options: NcOpenOptions, ) -> Result<Self>
Open a NetCDF-4 file from a custom random-access storage backend with custom options.
Sourcepub fn root_group(&self) -> Result<&NcGroup>
pub fn root_group(&self) -> Result<&NcGroup>
The root group.
Sourcepub fn is_classic_model(&self) -> bool
pub fn is_classic_model(&self) -> bool
Check if this file uses the classic data model (_nc3_strict).
This checks the raw HDF5 root group attributes (before the internal
attribute filter removes _nc3_strict).
pub fn dimensions(&self) -> Result<&[NcDimension]>
pub fn variables(&self) -> Result<&[NcVariable]>
pub fn global_attributes(&self) -> Result<&[NcAttribute]>
pub fn group(&self, path: &str) -> Result<&NcGroup>
pub fn variable(&self, path: &str) -> Result<&NcVariable>
pub fn dimension(&self, path: &str) -> Result<&NcDimension>
pub fn global_attribute(&self, path: &str) -> Result<&NcAttribute>
Sourcepub fn read_variable<T: H5Type>(&self, path: &str) -> Result<ArrayD<T>>
pub fn read_variable<T: H5Type>(&self, path: &str) -> Result<ArrayD<T>>
Read a variable’s data as a typed array.
Looks up the variable by path relative to the root group, then opens the matching HDF5 dataset and reads the data.
Sourcepub fn read_variable_into<T: H5Type>(
&self,
path: &str,
dst: &mut [T],
) -> Result<()>
pub fn read_variable_into<T: H5Type>( &self, path: &str, dst: &mut [T], ) -> Result<()>
Read a variable into a caller-provided typed buffer.
Sourcepub fn read_variable_raw_bytes(&self, path: &str) -> Result<Vec<u8>>
pub fn read_variable_raw_bytes(&self, path: &str) -> Result<Vec<u8>>
Read a variable as logical raw bytes in HDF5 datatype byte order.
Sourcepub fn read_variable_raw_bytes_into(
&self,
path: &str,
dst: &mut [u8],
) -> Result<()>
pub fn read_variable_raw_bytes_into( &self, path: &str, dst: &mut [u8], ) -> Result<()>
Read logical raw bytes into a caller-provided buffer.
Sourcepub fn read_variable_native_bytes(&self, path: &str) -> Result<Vec<u8>>
pub fn read_variable_native_bytes(&self, path: &str) -> Result<Vec<u8>>
Read a variable as logical raw bytes with numeric fields in native endian.
Sourcepub fn read_variable_native_bytes_into(
&self,
path: &str,
dst: &mut [u8],
) -> Result<()>
pub fn read_variable_native_bytes_into( &self, path: &str, dst: &mut [u8], ) -> Result<()>
Read native-endian logical raw bytes into a caller-provided buffer.
Sourcepub fn iter_variable_chunks(&self, path: &str) -> Result<DatasetChunkIterator>
pub fn iter_variable_chunks(&self, path: &str) -> Result<DatasetChunkIterator>
Iterate decoded HDF5 chunks for a chunked variable.
Sourcepub fn chunk_cache_stats(&self) -> ChunkCacheStats
pub fn chunk_cache_stats(&self) -> ChunkCacheStats
Return current chunk-cache statistics.
Sourcepub fn read_variable_as_string(&self, path: &str) -> Result<String>
pub fn read_variable_as_string(&self, path: &str) -> Result<String>
Read a string variable as a single string.
Sourcepub fn read_variable_as_strings(&self, path: &str) -> Result<Vec<String>>
pub fn read_variable_as_strings(&self, path: &str) -> Result<Vec<String>>
Read a string variable as a flat vector of strings.
Sourcepub fn read_variable_user_defined(&self, path: &str) -> Result<ArrayD<NcValue>>
pub fn read_variable_user_defined(&self, path: &str) -> Result<ArrayD<NcValue>>
Read a variable containing NetCDF-4 user-defined values.
Sourcepub fn read_variable_user_defined_with<T, F>(
&self,
path: &str,
decoder: F,
) -> Result<ArrayD<T>>
pub fn read_variable_user_defined_with<T, F>( &self, path: &str, decoder: F, ) -> Result<ArrayD<T>>
Read a NetCDF-4 user-defined variable through a custom decoder.
pub fn read_variable_parallel<T: H5Type>(&self, path: &str) -> Result<ArrayD<T>>
pub fn read_variable_in_pool<T: H5Type>( &self, path: &str, pool: &ThreadPool, ) -> Result<ArrayD<T>>
Source§impl Nc4File
impl Nc4File
Sourcepub fn read_variable_as_f64(&self, path: &str) -> Result<ArrayD<f64>>
pub fn read_variable_as_f64(&self, path: &str) -> Result<ArrayD<f64>>
Read a variable with automatic type promotion to f64.
Reads in the native HDF5 type and promotes to f64 via mapv.
Sourcepub fn read_variable_slice_as_f64(
&self,
path: &str,
selection: &NcSliceInfo,
) -> Result<ArrayD<f64>>
pub fn read_variable_slice_as_f64( &self, path: &str, selection: &NcSliceInfo, ) -> Result<ArrayD<f64>>
Read a slice of a variable with automatic type promotion to f64.
Sourcepub fn read_variable_slice<T: H5Type>(
&self,
path: &str,
selection: &NcSliceInfo,
) -> Result<ArrayD<T>>
pub fn read_variable_slice<T: H5Type>( &self, path: &str, selection: &NcSliceInfo, ) -> Result<ArrayD<T>>
Read a typed slice of a variable (NC4 delegation).
Sourcepub fn read_variable_slice_parallel<T: H5Type>(
&self,
path: &str,
selection: &NcSliceInfo,
) -> Result<ArrayD<T>>
pub fn read_variable_slice_parallel<T: H5Type>( &self, path: &str, selection: &NcSliceInfo, ) -> Result<ArrayD<T>>
Read a typed slice of a variable using chunk-level parallelism.
Chunked datasets decompress overlapping chunks in parallel via Rayon.
Non-chunked layouts fall back to read_variable_slice.
Auto Trait Implementations§
impl !Freeze for Nc4File
impl !RefUnwindSafe for Nc4File
impl Send for Nc4File
impl Sync for Nc4File
impl Unpin for Nc4File
impl UnsafeUnpin for Nc4File
impl !UnwindSafe for Nc4File
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more