Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion notebooks/10minutes/preprocessed_directories.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@
},
"outputs": [],
"source": [
"inversion_output = gdir.read_pickle('inversion_output') # The task above wrote the data to a pickle file - but we write to plenty of other files!\n",
"inversion_output = gdir.read_store('inversion_output') # The task above wrote the data to a npz file - but we write to plenty of other files!\n",
"\n",
"# Take the first flowline\n",
"fl = inversion_output[0]\n",
Expand Down
6 changes: 3 additions & 3 deletions notebooks/tutorials/elevation_bands_vs_centerlines.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@
},
"outputs": [],
"source": [
"fls_cl = gdir_cl.read_pickle('model_flowlines')\n",
"fls_eb = gdir_eb.read_pickle('model_flowlines')"
"fls_cl = gdir_cl.read_store('model_flowlines')\n",
"fls_eb = gdir_eb.read_store('model_flowlines')"
]
},
{
Expand Down Expand Up @@ -347,7 +347,7 @@
"colors = sns.color_palette('rocket', len(sel_years))\n",
"with plt.rc_context({'axes.prop_cycle': plt.cycler(color=colors)}):\n",
" f, (ax1, ax2) = plt.subplots(1, 2, figsize=(15, 5.5), sharey=True, sharex=True)\n",
" n_lines = len(gdir_cl.read_pickle('model_flowlines'))\n",
" n_lines = len(gdir_cl.read_store('model_flowlines'))\n",
" with xr.open_dataset(gdir_cl.get_filepath('fl_diagnostics', filesuffix=rid), group=f'fl_{n_lines-1}') as ds:\n",
" (ds.bed_h + ds.sel(time=sel_years).thickness_m).plot(ax=ax1, hue='time')\n",
" ds.bed_h.plot(ax=ax1, c='k')\n",
Expand Down
6 changes: 3 additions & 3 deletions notebooks/tutorials/ingest_gridded_data_on_flowlines.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,7 @@
},
"outputs": [],
"source": [
"fl = gdir.read_pickle('inversion_flowlines')[0]\n",
"fl = gdir.read_store('inversion_flowlines')[0]\n",
"df_regular['mean_elevation'] = fl.surface_h"
]
},
Expand Down Expand Up @@ -661,7 +661,7 @@
},
"outputs": [],
"source": [
"inv = gdir.read_pickle('inversion_output')[0]"
"inv = gdir.read_store('inversion_output')[0]"
]
},
{
Expand Down Expand Up @@ -751,7 +751,7 @@
},
"outputs": [],
"source": [
"inv = gdir.read_pickle('inversion_output')[0]"
"inv = gdir.read_store('inversion_output')[0]"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion notebooks/tutorials/inversion.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@
"# Add the glaciers outlines\n",
"for gdir in sel_gdirs:\n",
" crs = gdir.grid.center_grid\n",
" geom = gdir.read_pickle('geometries')\n",
" geom = gdir.read_store('geometries')\n",
" poly_pix = geom['polygon_pix']\n",
" smap.set_geometry(poly_pix, crs=crs, fc='none', zorder=2, linewidth=.2)\n",
" for l in poly_pix.interiors:\n",
Expand Down
2 changes: 1 addition & 1 deletion notebooks/tutorials/massbalance_calibration.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@
"source": [
"for gdir in gdirs:\n",
" mbmod = massbalance.MonthlyTIModel(gdir)\n",
" mean_mb = mbmod.get_specific_mb(fls=gdir.read_pickle('inversion_flowlines'),\n",
" mean_mb = mbmod.get_specific_mb(fls=gdir.read_store('inversion_flowlines'),\n",
" year=np.arange(2000,2020,1)).mean()\n",
" print(gdir.rgi_id, f': average MB 2000-2020 = {mean_mb:.1f} kg m-2, ',\n",
" f\"prcp_fac: {gdir.read_json('mb_calib')['prcp_fac']:.2f}\")"
Expand Down
4 changes: 2 additions & 2 deletions notebooks/tutorials/numeric_solvers.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@
"metadata": {},
"outputs": [],
"source": [
"fl_trap = gdir_eb.read_pickle('model_flowlines')\n",
"fl_trap = gdir_eb.read_store('model_flowlines')\n",
"fl_trap[-1].is_trapezoid[fl_trap[-1].thick == 0]"
]
},
Expand All @@ -366,7 +366,7 @@
"# IMPORTANT: need to call init_present_time_glacier to take effect\n",
"tasks.init_present_time_glacier(gdir_eb)\n",
"\n",
"fl_trap = gdir_eb.read_pickle('model_flowlines')\n",
"fl_trap = gdir_eb.read_store('model_flowlines')\n",
"fl_trap[-1].is_trapezoid[fl_trap[-1].thick == 0]"
]
},
Expand Down
12 changes: 6 additions & 6 deletions notebooks/tutorials/observed_thickness_with_dynamic_spinup.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,9 @@
" use_binned_thickness_data='millan_ice_thickness')\n",
"\n",
"# open the default oggm flowline and the two we just created\n",
"fls_oggm = gdir.read_pickle('model_flowlines')\n",
"fls_consensus = gdir.read_pickle('model_flowlines', filesuffix='_consensus')\n",
"fls_millan = gdir.read_pickle('model_flowlines', filesuffix='_millan')\n",
"fls_oggm = gdir.read_store('model_flowlines')\n",
"fls_consensus = gdir.read_store('model_flowlines', filesuffix='_consensus')\n",
"fls_millan = gdir.read_store('model_flowlines', filesuffix='_millan')\n",
"\n",
"# plot the created dynamic flowlines, including the oggm default\n",
"fig, axs = plt.subplots(2, 2, figsize=(10, 7))\n",
Expand Down Expand Up @@ -288,7 +288,7 @@
" else:\n",
" label = filesuffix[1:]\n",
"\n",
" fl = gdir.read_pickle('model_flowlines', filesuffix=filesuffix)[0]\n",
" fl = gdir.read_store('model_flowlines', filesuffix=filesuffix)[0]\n",
" with xr.open_dataset(\n",
" gdir.get_filepath('model_diagnostics',\n",
" filesuffix=f'_spinup_historical{filesuffix}')) as ds:\n",
Expand Down Expand Up @@ -360,7 +360,7 @@
" ref_volume = fls_millan[0].volume_m3\n",
" workflow.execute_entity_task(\n",
" tasks.run_dynamic_melt_f_calibration, gdirs,\n",
" init_model_fls=gdir.read_pickle('model_flowlines',\n",
" init_model_fls=gdir.read_store('model_flowlines',\n",
" filesuffix='_millan_adapted'),\n",
" err_dmdtda_scaling_factor=0.2,\n",
" ys=1979, ye=2020,\n",
Expand All @@ -385,7 +385,7 @@
"# conduct the dynamic initialisation once more to be sure the right one is saved\n",
"workflow.execute_entity_task(\n",
" tasks.run_dynamic_melt_f_calibration, gdirs,\n",
" init_model_fls=gdir.read_pickle('model_flowlines', filesuffix='_millan_adapted'),\n",
" init_model_fls=gdir.read_store('model_flowlines', filesuffix='_millan_adapted'),\n",
" err_dmdtda_scaling_factor=0.2,\n",
" ys=1979, ye=2020,\n",
" melt_f_max=cfg.PARAMS['melt_f_max'],\n",
Expand Down
2 changes: 1 addition & 1 deletion notebooks/tutorials/plot_mass_balance.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
"mbmod = massbalance.MultipleFlowlineMassBalance(gdir)\n",
"\n",
"# Compute the specific MB for this glacier\n",
"fls = gdir.read_pickle('model_flowlines')\n",
"fls = gdir.read_store('model_flowlines')\n",
"years = np.arange(1950, 2019)\n",
"mb_ts = mbmod.get_specific_mb(fls=fls, year=years)\n",
"\n",
Expand Down
2 changes: 1 addition & 1 deletion notebooks/tutorials/running_oggm_with_avalanches.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@
"from snowslide.oggm_snowslide_compat_minimal import MonthlyTIAvalancheModel\n",
"\n",
"# Get flowline\n",
"flowline = gdir.read_pickle('inversion_flowlines')[0]\n",
"flowline = gdir.read_store('inversion_flowlines')[0]\n",
"\n",
"# get mass balance model\n",
"mb_control = MonthlyTIModel(gdir)\n",
Expand Down
4 changes: 2 additions & 2 deletions notebooks/tutorials/where_are_the_flowlines.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@
"outputs": [],
"source": [
"# Get the centerlines\n",
"cls = gdir.read_pickle('centerlines')\n",
"cls = gdir.read_store('centerlines')\n",
"# Get the coord of the last point of the main centerline\n",
"cl = cls[-1]\n",
"i, j = cl.line.coords[-1]\n",
Expand Down Expand Up @@ -195,7 +195,7 @@
"outputs": [],
"source": [
"# Get the flowlines\n",
"cls = gdir.read_pickle('inversion_flowlines')\n",
"cls = gdir.read_store('inversion_flowlines')\n",
"# Get the coord of the last point of the main centerline\n",
"cl = cls[-1]\n",
"i, j = cl.line.coords[-1]\n",
Expand Down
Loading