cgeniepy.model#

Classes#

GenieModel

GenieModel is the interface to cGENIE output

Module Contents#

class cgeniepy.model.GenieModel(model_path: str | List | Tuple, gemflag=None)#

Bases: object

GenieModel is the interface to cGENIE output

model_path#
ncvar_dict#
tsvar_list#
__repr__()#
get_var(var: str | List | Tuple, attrs=None)#

Get the data of target variable. A list of variables is supported as well.

Parameters:
  • var – the name of target variable

  • unit – the unit of target variable, usually provided in the model output

Example#

>>> from cgeniepy.model import GenieModel
>>> model = GenieModel("path_to_GENIE_output")
>>> po4 = model.get_var("ocn_PO4")
get_config(config_name='BIOGEM')#
get_ts(var: str, to_ScatterData=False)#

read in time series output of GENIE

Parameters:

var – the name of the target variable

Returns:

a pandas DataFrame

get_diag_avg(target_year, is_index=False, pattern_year='\\d+', pattern_year_digit='\\d{3}')#

read the diagnostic file of cGENIE

Parameters:
  • target_year – the target year of the diagnostic file

  • is_index – if True, target_year is the index of the sorted years

  • pattern – the pattern of the diagnostic file name

Returns:

a pandas DataFrame

Example#

>>> from cgeniepy.model import GenieModel
>>> model = GenieModel("path_to_GENIE_output")
>>> model.get_diag_avg(9999)
grid_mask()#

cGENIE continent mask array (by setting zero values), either calculated from existing data or using biogem.grid_mask

grid_category()#

an alogirthm to define surface grid catogories depending on the land-sea mask 0: coastal sea 1: land 2: open ocean

grid_area()#

return the grid area array in used in this model experiment, unit: m2

grid_mask_3d()#

return the 3d mask of the grid used in this model experiment

grid_topo()#

return the topography of the grid used in this model experiment

grid_zt_edges()#

return the depth edges of the grid used in this model experiment

grid_lat_edges()#

return the latitude edges of the grid used in this model experiment

grid_lon_edges()#

return the longitude edges of the grid used in this model experiment

grid_zt_depths()#

return the depth of the grid used in this model experiment

grid_volume()#

return the grid volume array (3d) in m3