Skip to content

Enabling daily mass balance functionality#143

Merged
btobers merged 32 commits intodevfrom
133-mb_daily
Nov 4, 2025
Merged

Enabling daily mass balance functionality#143
btobers merged 32 commits intodevfrom
133-mb_daily

Conversation

@drounce
Copy link
Collaborator

@drounce drounce commented Oct 14, 2025

Adding the functionality throughout the mass balance functions, dates table, cfg files, etc. to include mass balance functionality

@btobers btobers marked this pull request as draft October 14, 2025 19:32
@btobers
Copy link
Collaborator

btobers commented Oct 15, 2025

Note, this will fail our test notebooks until a patch to https://github.com/PyGEM-Community/PyGEM-notebooks/tree/dev is completed. Will work on this after #137 is closed.

@btobers
Copy link
Collaborator

btobers commented Oct 16, 2025

Note, this is currently failing test_04 - postprocessing, specifically because the postproc_monthly_mass script is called, which will now break because of changes to the output data structure.

@btobers
Copy link
Collaborator

btobers commented Oct 20, 2025

@drounce I've updated two previous postprocessing scripts following the updates to the mass balance model now running on daily/monthly steps:

  • postproc_monthly_mass.py -> postproc_subannual_mass.py
  • postproc_binned_monthly_mass.py -> postproc_binned_subannual_thick.py

Both of these postprocessing scripts will now work with either monthly/daily model outputs. Similarly, the postprocessing teststuite (test_04_postproc.py) has been updated to now call these updates scripts after running through the test notebooks from PyGEM-notebooks.

All output variables names have also been updated to remove "monthly." Annual variables still have "annual" in their variable names (e.g. glac_mass_annual). Non-annual variables have their timestep indicated by the variable's temporal_resolution attribute value:
e.g.,

self.output_attrs_dict['glac_runoff'] = {
    'long_name': 'glacier-wide runoff',
    'units': 'm3',
    'temporal_resolution': self.timestep,
    'comment': 'runoff from the glacier terminus, which moves over time',
        }

One other major update rolled into this PR: try/except blocks were removed from run_simulation.py. Now, if a particular option_dynamics run fails, the run will not proceed to try another option and will rather just store a failed log. The dynamical model option is also now stored in the output dataset under the "model_parameters" attribute (along with other model parameters) for improved bookkeeping:

        self.mdl_params_dict['ref_startyear'] = self.ref_startyear
        self.mdl_params_dict['ref_endyear'] = self.ref_endyear
        self.mdl_params_dict['sim_startyear'] = self.sim_startyear
        self.mdl_params_dict['sim_endyear'] = self.sim_endyear
        self.mdl_params_dict['sim_climate_name'] = self.sim_climate_name
        self.mdl_params_dict['realization'] = self.realization
        self.mdl_params_dict['sim_climate_scenario'] = self.sim_climate_scenario
        self.mdl_params_dict['option_calibration'] = self.option_calibration
        self.mdl_params_dict['option_bias_adjustment'] = self.option_bias_adjustment
        self.mdl_params_dict['option_dynamics'] = self.option_dynamics
        self.mdl_params_dict['timestep'] = self.timestep
...
...
        'model_parameters': json.dumps(self.mdl_params_dict),

@btobers
Copy link
Collaborator

btobers commented Oct 20, 2025

@drounce I believe lines 435-438 of glacierdynamics.py should be updated following the new 'days_in_step' datesmodelrun() setup. This is the only place where I found 'daysinmonth' being called, so I believe that the function pygem_modelsetup.daysinmonth() can be removed.

@btobers
Copy link
Collaborator

btobers commented Oct 21, 2025

@drounce I believe lines 435-438 of glacierdynamics.py should be updated following the new 'days_in_step' datesmodelrun() setup. This is the only place where I found 'daysinmonth' being called, so I believe that the function pygem_modelsetup.daysinmonth() can be removed.

This has now been address in PR #147, and now I believe we can remove pygem_modelsetup.daysinmonth()

@btobers
Copy link
Collaborator

btobers commented Oct 21, 2025

@drounce I believe lines 435-438 of glacierdynamics.py should be updated following the new 'days_in_step' datesmodelrun() setup. This is the only place where I found 'daysinmonth' being called, so I believe that the function pygem_modelsetup.daysinmonth() can be removed.

This has now been address in PR #147, and now I believe we can remove pygem_modelsetup.daysinmonth()

pygem_modelsetup.daysinmonth() function removed in PR #147

@btobers btobers marked this pull request as ready for review November 4, 2025 00:37
@btobers btobers self-requested a review November 4, 2025 00:57
@btobers btobers merged commit c437c27 into dev Nov 4, 2025
1 check passed
@btobers btobers deleted the 133-mb_daily branch November 4, 2025 01:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants