cgeniepy.chem#
Classes#
Module Contents#
- class cgeniepy.chem.Chemistry#
- molar_mass(element: str)#
get molar mass (g/mol) of chemistry elements
- molecular_weight(formula: str)#
Calculate molecular weight using a chemical formula
- Parameters:
formula – chemical formula
- Returns:
molecular weight
>>> molecular_weight("C6H12O6") >>> 180.15588
- pure_unit(unit: str)#
Get a pure unit string by removing elements in string (e.g., mmol C d-1)
- Parameters:
unit – unit string with elements
- Returns:
pure unit string
>>> pure_unit("mmol C d-1") >>> "mmol d-1"
- format_base_unit(input_str, latex_format=True)#
Convert the base unit (i.e., no whitespace) to the desired format
base unit means it is not a compound unit (e.g., m2, m-2, m/s, m s-1), which should be handled by the function format_unit
- Parameters:
input_str – a base unit string
- Returns:
a formatted string
Example:#
>>> convert_a_unit('m2') '$m^2$' >>> convert_a_unit('m-2') '$m^{-2}$'
- format_unit(input, *args, **kwargs)#
convert a unit in a string seprated by whitespace to the desired format, which can be used in plot labels and facilitate the unit calculation
- Parameters:
input – a unit string
- Returns:
a formatted string
Example:#
>>> format_unit('mol kg-1') 'mol kg$^{-1}$' >>> format_unit('mmol m-2 d-1') 'mmol m$^{-2}$ d$^{-1}$'
- class cgeniepy.chem.ModelCarbon(model)#
- model#
- get_NPP()#
netprimary production (NPP) in Pg C yr-1
- get_poc_export(depth=None)#
particulate organic carbon (POC) export at 80 m in Pg C yr-1
- get_eratio()#
export ratio (ER), calculated as POC export at 80 m divided by NPP
- get_Teff(zt1=80, zt2=1000)#
transfer efficiency (Teff), default calculated as POC export at 1000 m divided by POC export at 80 m