model
Retrieves SMB and firn model parameters for known models and from model definition files
General Attributes and Methods
- FirnCorr.io.load_database(extra_databases: list = [])[source]
Load the
JSONdatabase of model files- Parameters:
- extra_databases: list, default []
A list of additional databases to load, as either
JSONfile paths or dictionaries
- Returns:
- parameters: dict
Database of model parameters
- class FirnCorr.io.model(directory: str | Path | None = None, **kwargs)[source]
Retrieves SMB and firn model parameters for named models
- Attributes:
- compressed: bool
Model files are gzip compressed
- directory: str, pathlib.Path or None, default None
Working data directory for SMB and firn models
- extra_databases: list, default []
Additional databases for model parameters
- verify: bool
Verify that all model files exist
- from_database(m: str, group: tuple = ('ais', 'gris'))[source]
Create a model object from database of known models
- Parameters:
- m: str
Model name
- group: tuple, default (“ais”, “gris”)
Model region(s) to extract
- from_file(definition_file: str | Path | IOBase, **kwargs)[source]
Create a model object from an input definition file
- Parameters:
- definition_file: str, pathlib.Path or io.IOBase
Model definition file for creating model object
- from_dict(d: dict)[source]
Create a model object from a dictionary of parameters
- Parameters:
- d: dict
Model object parameters
- to_dict(**kwargs)[source]
Create a dictionary from a model object
- Parameters:
- fields: list, default all
List of model attributes to output
- serialize: bool, default False
Serialize dictionary for
JSONoutput
- property gzip: str
Returns suffix for
gzipcompression
- property engine: str
Returns the read-write engine for the model
- property file_format: str
Returns the file format for the model
- property crs
Coordinate reference system of the model
- pathfinder(model_file: str | Path | list)[source]
Completes file paths and appends
gzipsuffix- Parameters:
- model_file: str, pathlib.Path or list
Model file(s) to complete
- serialize(d: dict)[source]
Encodes dictionary to be
JSONserializable- Parameters:
- d: dict
Parameters to serialize