ocssw
V2022
|
seadasutils.netcdf_utils Namespace Reference
Functions | |
def | nccopy_var (srcvar, dstgrp, indices=None, verbose=False) |
def | nccopy_grp (srcgrp, dstgrp, indices=None, verbose=False) |
def | nccopy (srcfile, dstfile, verbose=False) |
def | ncsubset_vars (srcfile, dstfile, subset, verbose=False, **kwargs) |
def | update_history (dataset, timestamp=None, cmdline=None) |
Detailed Description
Module containing utilities to manipulate netCDF4 files.
Function Documentation
◆ nccopy()
def seadasutils.netcdf_utils.nccopy | ( | srcfile, | |
dstfile, | |||
verbose = False |
|||
) |
Copy a netCDF4 file. Function to copy a netCDF4 file to a new file. Intended mostly as a demonstration. Parameters ---------- srcfile : str Path to source file; must be netCDF4 format. dstfile : str Path to destination file; directory must exist. verbose : boolean, optional Print extra info
Definition at line 121 of file netcdf_utils.py.
◆ nccopy_grp()
def seadasutils.netcdf_utils.nccopy_grp | ( | srcgrp, | |
dstgrp, | |||
indices = None , |
|||
verbose = False |
|||
) |
Recursively copy a netCDF4 group, optionally subsetting some dimensions. Function to recursively copy a netCDF4 group, with associated attributes, dimensions and variables. Optionally subset specified dimensions. Parameters ---------- srcgrp : netCDF4.Group Open Group or Dataset source object containing stuff to be copied dstgrp : netCDF4.Group Open Group or Dataset destination object to copy stuff to indices : dict, optional Dict of dimname:[indexarr] to subset a dimension verbose : boolean, optional Print extra info
Definition at line 74 of file netcdf_utils.py.
◆ nccopy_var()
def seadasutils.netcdf_utils.nccopy_var | ( | srcvar, | |
dstgrp, | |||
indices = None , |
|||
verbose = False |
|||
) |
Copy a netCDF4 variable, optionally subsetting some dimensions. Function to copy a single netCDF4 variable and associated attributes. Optionally subset specified dimensions. Parameters ---------- srcvar : netCDF4.Variable Open variable to be copied dstgrp : netCDF4.Group Open Group or Dataset destination object to copy stuff to indices : dict, optional Dict of dimname:[indexarr] to subset a dimension verbose : boolean, optional Print extra info Side Effects ------------ Strings are written as H5T_CSET_ASCII, not H5T_CSET_UTF8 Empty attributes are written as scalar "" instead of NULL
Definition at line 13 of file netcdf_utils.py.
◆ ncsubset_vars()
def seadasutils.netcdf_utils.ncsubset_vars | ( | srcfile, | |
dstfile, | |||
subset, | |||
verbose = False , |
|||
** | kwargs | ||
) |
Copy a netCDF4 file, with some dimensions subsetted. Function to copy netCDF4 file to a new file, Function to copy a single netCDF4 variable and associated attributes. Optionally subset specified dimensions. Parameters ---------- srcfile : str Path to source file; must be netCDF4 format. dstfile : str Path to destination file; directory must exist. subset : dict, optional Dict of dimname:[startindex,endindex] to subset a dimension verbose : boolean, optional Print extra info Side Effects ------------ Strings are written as H5T_CSET_ASCII, not H5T_CSET_UTF8 Empty attributes are written as scalar "" instead of NULL
Definition at line 144 of file netcdf_utils.py.
◆ update_history()
def seadasutils.netcdf_utils.update_history | ( | dataset, | |
timestamp = None , |
|||
cmdline = None |
|||
) |
Update 'date_created' and 'history' attributes Function to add or update 'date_created' and 'history' attributes for specified dataset (usually root). Parameters ---------- dataset : netCDF4.Group Open Group or Dataset destination object to update timestamp : time.struct_time, optional Timestamp to add to history attribute Defaults to current time cmdline : string, optional Description to add to history attribute
Definition at line 210 of file netcdf_utils.py.