phyex1d
1D model using PHYEX
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Static Public Attributes | Protected Attributes | List of all members
phyex1d.case.CaseCommonFormat Class Reference
Inheritance diagram for phyex1d.case.CaseCommonFormat:
Inheritance graph
[legend]
Collaboration diagram for phyex1d.case.CaseCommonFormat:
Collaboration graph
[legend]

Public Member Functions

 __init__ (self, inputfile, attrs=None)
 
 is_open (self)
 
 open (self)
 
 close (self)
 
 contains (self, varname)
 
 get (self, varname, slice_idx=None)
 
 duration (self)
 
 get_interpolator (self, varname, grid)
 
 description (self)
 
- Public Member Functions inherited from phyex1d.case.Case
 __enter__ (self)
 
 __exit__ (self, *args)
 

Public Attributes

 adv_ua
 
 adv_va
 

Static Public Attributes

dict nc_names
 

Protected Attributes

 _inputfile
 
 _nc
 
 _interpolators
 

Detailed Description

Case backed by a netCDF driver file in the DEPHY common format

Constructor & Destructor Documentation

◆ __init__()

phyex1d.case.CaseCommonFormat.__init__ (   self,
  inputfile,
  attrs = None 
)
:param inputfile: path to a netCDF driver file
:param attrs: dictionary of attributes to override

Member Function Documentation

◆ close()

phyex1d.case.CaseCommonFormat.close (   self)
Close the netCDF file if open

Reimplemented from phyex1d.case.Case.

◆ contains()

phyex1d.case.CaseCommonFormat.contains (   self,
  varname 
)
Check if a variable exists in the netCDF file

Parameters
----------
varname : str
    Variable name (translated via nc_names if present)

Returns
-------
bool
    True if the variable exists

Reimplemented from phyex1d.case.Case.

◆ description()

phyex1d.case.CaseCommonFormat.description (   self)
Case description

Returns
-------
str
    Case description string (file path)

Reimplemented from phyex1d.case.Case.

◆ duration()

phyex1d.case.CaseCommonFormat.duration (   self)
Simulation duration

Returns
-------
float
    Duration in seconds (time[-1] - time[0])

Reimplemented from phyex1d.case.Case.

◆ get()

phyex1d.case.CaseCommonFormat.get (   self,
  varname,
  slice_idx = None 
)
Read a variable from the netCDF file

Parameters
----------
varname : str
    Variable name (translated via nc_names if present)
slice_idx : int or None, optional
    Slice index to read. None returns the full array.

Returns
-------
numpy.ndarray
    The data array

Reimplemented from phyex1d.case.Case.

◆ get_interpolator()

phyex1d.case.CaseCommonFormat.get_interpolator (   self,
  varname,
  grid 
)
Get from cache or build an interpolator for a forcing variable

Parameters
----------
varname : str
    Variable name
grid : Grid
    Grid instance for vertical coordinate

Returns
-------
RegularGridInterpolator
    The interpolator

Reimplemented from phyex1d.case.Case.

◆ is_open()

phyex1d.case.CaseCommonFormat.is_open (   self)
Whether the netCDF file is currently open

◆ open()

phyex1d.case.CaseCommonFormat.open (   self)
Open the netCDF file if not already open

Returns
-------
netCDF4.Dataset
    The opened dataset

The documentation for this class was generated from the following file: