Skip to content
2 changes: 1 addition & 1 deletion pygem/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

copyright © 2018 David Rounce <drounce@cmu.edu

Distrubted under the MIT lisence
Distributed under the MIT license
"""

from importlib.metadata import version
Expand Down
2 changes: 1 addition & 1 deletion pygem/bin/op/compress_gdirs.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

copyright © 2024 Brandon Tober <btober@cmu.edu> David Rounce <drounce@cmu.edu>

Distrubted under the MIT lisence
Distributed under the MIT license

compress OGGM glacier directories
"""
Expand Down
2 changes: 1 addition & 1 deletion pygem/bin/op/duplicate_gdirs.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

copyright © 2024 Brandon Tober <btober@cmu.edu> David Rounce <drounce@cmu.edu>

Distrubted under the MIT lisence
Distributed under the MIT license

duplicate OGGM glacier directories
"""
Expand Down
2 changes: 1 addition & 1 deletion pygem/bin/op/initialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

copyright © 2024 Brandon Tober <btober@cmu.edu> David Rounce <drounce@cmu.edu>

Distrubted under the MIT lisence
Distributed under the MIT license

initialization script (ensure config.yaml and get sample datasets)
"""
Expand Down
2 changes: 1 addition & 1 deletion pygem/bin/op/list_failed_simulations.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

copyright © 2018 David Rounce <drounce@cmu.edu>

Distrubted under the MIT lisence
Distributed under the MIT license

script to check for failed glaciers for a given simulation and export a pickle file containing a list of said glacier numbers to be reprocessed
"""
Expand Down
2 changes: 1 addition & 1 deletion pygem/bin/postproc/postproc_binned_monthly_mass.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

copyright © 2024 Brandon Tober <btober@cmu.edu> David Rounce <drounce@cmu.edu>

Distrubted under the MIT lisence
Distributed under the MIT license

derive binned monthly ice thickness and mass from PyGEM simulation
"""
Expand Down
2 changes: 1 addition & 1 deletion pygem/bin/postproc/postproc_compile_simulations.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

copyright © 2024 Brandon Tober <btober@cmu.edu> David Rounce <drounce@cmu.edu>

Distrubted under the MIT lisence
Distributed under the MIT license

compile individual glacier simulations to the regional level
"""
Expand Down
2 changes: 1 addition & 1 deletion pygem/bin/postproc/postproc_distribute_ice.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

copyright © 2024 Brandon Tober <btober@cmu.edu> David Rounce <drounce@cmu.edu>

Distrubted under the MIT lisence
Distributed under the MIT license
"""

# Built-in libraries
Expand Down
2 changes: 1 addition & 1 deletion pygem/bin/postproc/postproc_monthly_mass.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

copyright © 2024 Brandon Tober <btober@cmu.edu> David Rounce <drounce@cmu.edu>

Distrubted under the MIT lisence
Distributed under the MIT license

derive monthly glacierwide mass for PyGEM simulation using annual glacier mass and monthly total mass balance
"""
Expand Down
2 changes: 1 addition & 1 deletion pygem/bin/preproc/preproc_fetch_mbdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

copyright © 2018 David Rounce <drounce@cmu.edu>

Distrubted under the MIT lisence
Distributed under the MIT license

Fetch filled Hugonnet reference mass balance data
"""
Expand Down
2 changes: 1 addition & 1 deletion pygem/bin/preproc/preproc_wgms_estimate_kp.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

copyright © 2018 David Rounce <drounce@cmu.edu>

Distrubted under the MIT lisence
Distributed under the MIT license

Process the WGMS data to connect with RGIIds and evaluate potential precipitation biases

Expand Down
2 changes: 1 addition & 1 deletion pygem/bin/run/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@

copyright © 2018 David Rounce <drounce@cmu.edu

Distrubted under the MIT lisence
Distributed under the MIT license
"""
24 changes: 15 additions & 9 deletions pygem/bin/run/run_calibration.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

copyright © 2018 David Rounce <drounce@cmu.edu>

Distrubted under the MIT lisence
Distributed under the MIT license

Run model calibration
"""
Expand Down Expand Up @@ -37,15 +37,10 @@
# read the config
pygem_prms = config_manager.read_config()

import pygem.oggm_compat as oggm_compat
import pygem.pygem_modelsetup as modelsetup
from pygem import class_climate, mcmc
from pygem.massbalance import PyGEMMassBalance

# from pygem.glacierdynamics import MassRedistributionCurveModel
from pygem.oggm_compat import (
single_flowline_glacier_directory,
single_flowline_glacier_directory_with_calving,
)
from pygem.utils.stats import mcmc_stats

# from oggm.core import climate
Expand Down Expand Up @@ -175,6 +170,11 @@ def getparser():
action='store_true',
help='Flag to keep glacier lists ordered (default is false)',
)
parser.add_argument(
'-spinup',
action='store_true',
help='Flag to use spinup flowlines (default is false)',
)
parser.add_argument(
'-p', '--progress_bar', action='store_true', help='Flag to show progress bar'
)
Expand Down Expand Up @@ -605,11 +605,13 @@ def run(list_packed_vars):
glacier_rgi_table['TermType'] not in [1, 5]
or not pygem_prms['setup']['include_frontalablation']
):
gdir = single_flowline_glacier_directory(glacier_str)
gdir = oggm_compat.single_flowline_glacier_directory(glacier_str)
gdir.is_tidewater = False
else:
# set reset=True to overwrite non-calving directory that may already exist
gdir = single_flowline_glacier_directory_with_calving(glacier_str)
gdir = oggm_compat.single_flowline_glacier_directory_with_calving(
glacier_str
)
gdir.is_tidewater = True

fls = gdir.read_pickle('inversion_flowlines')
Expand Down Expand Up @@ -704,6 +706,10 @@ def run(list_packed_vars):
'Mass balance data missing. Check dataset and column names'
)

# if spinup, grab appropriate flowlines
if args.spinup:
fls = oggm_compat.get_spinup_flowlines(gdir, y0=args.ref_startyear)

# ----- CALIBRATION OPTIONS ------
if (fls is not None) and (gdir.mbdata is not None) and (glacier_area.sum() > 0):
modelprms = {
Expand Down
6 changes: 3 additions & 3 deletions pygem/bin/run/run_calibration_frontalablation.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

copyright © 2018 David Rounce <drounce@cmu.edu>

Distrubted under the MIT lisence
Distributed under the MIT license

Calibrate frontal ablation parameters for tidewater glaciers
"""
Expand Down Expand Up @@ -260,10 +260,10 @@ def reg_calving_flux(
cfg.PARAMS['calving_k'] = calving_k
cfg.PARAMS['inversion_calving_k'] = cfg.PARAMS['calving_k']

if pygem_prms['sim']['oggm_dynamics']['use_reg_glena']:
if pygem_prms['sim']['oggm_dynamics']['use_regional_glen_a']:
glena_df = pd.read_csv(
pygem_prms['root']
+ pygem_prms['sim']['oggm_dynamics']['glena_reg_relpath']
+ pygem_prms['sim']['oggm_dynamics']['glen_a_regional_relpath']
)
glena_idx = np.where(glena_df.O1Region == glacier_rgi_table.O1Region)[
0
Expand Down
6 changes: 3 additions & 3 deletions pygem/bin/run/run_calibration_reg_glena.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

copyright © 2018 David Rounce <drounce@cmu.edu>

Distrubted under the MIT lisence
Distributed under the MIT license

Find the optimal values of glens_a_multiplier to match the consensus ice thickness estimates
"""
Expand Down Expand Up @@ -559,7 +559,7 @@ def to_minimize(a_multiplier):

try:
glena_df = pd.read_csv(
f'{pygem_prms["root"]}/{pygem_prms["out"]["glena_reg_relpath"]}'
f'{pygem_prms["root"]}/{pygem_prms["out"]["glen_a_regional_relpath"]}'
)

# Add or overwrite existing file
Expand All @@ -578,7 +578,7 @@ def to_minimize(a_multiplier):
glena_df = glena_df.sort_values('O1Region', ascending=True)
glena_df.reset_index(inplace=True, drop=True)
glena_df.to_csv(
f'{pygem_prms["root"]}/{pygem_prms["out"]["glena_reg_relpath"]}',
f'{pygem_prms["root"]}/{pygem_prms["out"]["glen_a_regional_relpath"]}',
index=False,
)

Expand Down
Loading