Skip to content

Commit

Permalink
update for img url
Browse files Browse the repository at this point in the history
  • Loading branch information
fmaussion committed May 14, 2021
1 parent 5735d45 commit 263dd67
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions oggm_edu/funcs.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
oggm-edu - plots
@author: Zora
oggm-edu - useful functions
"""
import numpy as np
import xarray as xr
import urllib
import pandas as pd
import matplotlib.pyplot as plt
from oggm.core.flowline import (FluxBasedModel,
Expand All @@ -16,10 +13,13 @@

# allow to plot pictures as subplots
import matplotlib.image as mpimg
from PIL import Image

graphics_url = 'https://raw.githubusercontent.com/OGGM/glacier-graphics/master/glacier_intro/png/glacier_{}.png'


def plot_glacier_graphics(num='01', title=False):
glacier_graphics = 'https://raw.githubusercontent.com/OGGM/glacier-graphics/master/glacier_intro/png/glacier_{}.png'
plt.imshow(mpimg.imread(glacier_graphics.format(num)))
plt.imshow(Image.open(urllib.request.urlopen(graphics_url.format(num))))
ax =plt.gca()
ax.patch.set_visible(False)
ax.axis('off')
Expand Down Expand Up @@ -299,7 +299,7 @@ def response_time_vol(model, perturbed_mb):
except RuntimeError:
count += 1
# if equilibrium not reached yet, add 1000 years. Then try again.
model.run_until(models[0].yr + 1000)
model.run_until(model.yr + 1000)
if count == 6:
raise RuntimeError('Because the gradient is be very small, '
'the equilibrium will be reached only '
Expand All @@ -317,7 +317,7 @@ def response_time_vol(model, perturbed_mb):
except RuntimeError:
count += 1
# if equilibrium not reached yet, add 1000 years. Then try again.
pert_model.run_until(models[0].yr + 1000)
pert_model.run_until(model.yr + 1000)
if count == 6:
raise RuntimeError('Because the gradient is be very small, '
'the equilibrium will be reached only '
Expand Down

0 comments on commit 263dd67

Please sign in to comment.