Пример #1
0
del vx, vy

# Load masks
xmask,ymask,mask = masklib.load_grid('Helheim',np.min(xvel_HG),np.max(xvel_HG),\
        np.min(yvel_HG),np.max(yvel_HG),100,icefront_time=imagetime_HG)
mask[:, xmask > 277000 + 38e3] = 1
vel_masked_HG = np.ma.masked_array(vel_HG, mask)

xmask,ymask,mask = masklib.load_grid('Kanger',np.min(xvel_KG),np.max(xvel_KG),\
        np.min(yvel_KG),np.max(yvel_KG),100,icefront_time=imagetime_KG)
mask[:, xmask > 462000 + 38e3] = 1
vel_masked_KG = np.ma.masked_array(vel_KG, mask)
del vel_KG, vel_HG, xmask, ymask, mask

# Load min velocities for showing region where velocity is above cutoff
x_cutoff_KG, y_cutoff_KG, vsurfini_cutoff_KG, ind_cutoff_grid, ind_cutoff  = inverselib.get_velocity_cutoff('Kanger',\
        velocity_cutoff=velocity_cutoff,model_dir='INV_SSA_ModelT')
x_cutoff_HG, y_cutoff_HG, vsurfini_cutoff_HG, ind_cutoff_grid, ind_cutoff  = inverselib.get_velocity_cutoff('Helheim',\
        velocity_cutoff=velocity_cutoff,model_dir='INV_SSA_ModelT')

# Figure
fig = plt.figure(figsize=(3.2, 1.8))
gs = matplotlib.gridspec.GridSpec(1, 2)

ax = plt.subplot(gs[0])
cx = cubehelix.cmap(start=1.2, rot=-1.1, reverse=True, minLight=0.1, sat=2)
p=plt.imshow(vel_masked_KG/1e3,extent=[np.min(xvel_KG),np.max(xvel_KG),np.min(yvel_KG),\
        np.max(yvel_KG)],origin='lower',clim=[0,8],cmap=cx)
ax = plt.gca()
ax.imshow(image_KG[:,:,0],extent=[np.min(ximage_KG),np.max(ximage_KG),np.min(yimage_KG),\
        np.max(yimage_KG)],cmap='Greys_r',origin='lower',clim=[0,0.6])
ax.imshow(vel_masked_KG/1e3,extent=[np.min(xvel_KG),np.max(xvel_KG),np.min(yvel_KG),\
Пример #2
0
elif glacier == 'Helheim':
    fig = plt.figure(figsize=(7.5, 15))
matplotlib.rc('font', family='Arial')
gs = matplotlib.gridspec.GridSpec(6, 4)

if beta_date == '':
    no_beta_file = True
else:
    no_beta_file = False

vmin = -20
vmax = 20
cmap = 'RdYlBu_r'

# Get indices where velocity is always greater than the cutoff value
x_cutoff,y_cutoff,vsurfini_cutoff,ind_cutoff_grid, ind_cutoff  = inverselib.get_velocity_cutoff(glacier,\
 velocity_cutoff=cutoff,SSA=False)

# Now create plots and get misfit values for velocities > cutoff
n = 0
for dir in np.sort(dirs):
    if dir.startswith('DEM') and dir.endswith(temperature_text):
        if no_beta_file:
            beta_date = dir[3:11]
            beta_suffix = regpar + '_' + modelname + '_DEM' + beta_date + '_' + temperature_text + '_' + slidinglaw
        elif beta_date == 'average':
            beta_suffix = regpar + '_' + modelname + '_average_2000_2016_' + temperature_text + '_' + slidinglaw
        else:
            beta_suffix = regpar + '_' + modelname + '_DEM' + beta_date + '_' + temperature_text + '_' + slidinglaw

        data = elmerreadlib.pvtu_file(maindir+dir+'/mesh2d/steady_'+beta_suffix+\
                '0001.pvtu',['vsurfini',vname])
Пример #3
0
if SSA and temperature == 'model':
    maindir = os.path.join(os.getenv("MODEL_HOME"),
                           glacier + '/3D/INV_SSA_ModelT/')
elif SSA and temperature != 'model':
    maindir = os.path.join(os.getenv("MODEL_HOME"),
                           glacier + '/3D/INV_SSA_ConstantT/')
dirs = os.listdir(maindir)

# Get length of model files for setting up variables
n = 0
for dir in dirs:
    if dir.startswith('DEM') and dir.endswith(temperature_text):
        n = n + 1

# Get indices where velocity is always greater than the cutoff value
x_cutoff,y_cutoff,vsurfini_cutoff,ind_cutoff_grid, ind_cutoff = inverselib.get_velocity_cutoff(glacier,velocity_cutoff=cutoff,\
        model_dir='INV_SSA_ModelT',sign=sign)

# Sliding exponents
m = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 50, 100]

# Set up variables
times = np.zeros([
    n,
])
misfits_ave_mape = np.zeros([len(m), n])
misfits_ave_rmse = np.zeros([len(m), n])
misfits_one_rmse = np.zeros([len(m), n])
misfits_one_mape = np.zeros([len(m), n])
misfits_inv_mape = np.zeros([
    n,
])
# Cutoff for calculating mean absolute residual
cutoff = 1000.0
if glacier == 'Kanger':
    beta_suffix = 'DEM20120522'
elif glacier == 'Helheim':
    beta_suffix = 'DEM20120316'

# Get directories
DIRG = os.path.join(os.getenv("MODEL_HOME"), glacier + '/Results/')
DIR_SSA_MT = DIRG + "INV_SSA_ModelT/"
DIR_SSA_CT = DIRG + "INV_SSA_ConstantT/"
DIR_FS_MT = DIRG + "INV_FS_ModelT/"
DIR_FS_CT = DIRG + "INV_FS_ConstantT/"

# Get indices where velocity is always greater than the cutoff value
x_cutoff_SSA,y_cutoff_SSA,vsurfini_cutoff_SSA,ind_cutoff_grid,ind_cutoff_SSA  = inverselib.get_velocity_cutoff(glacier,\
        velocity_cutoff=cutoff,model_dir='INV_SSA_ModelT',SSA=True,sign='over')
x_cutoff_SSA_fast,y_cutoff_SSA_fast,vsurfini_cutoff_SSA_fast,ind_cutoff_grid_fast,ind_cutoff_SSA_fast  = inverselib.get_velocity_cutoff(glacier,\
        velocity_cutoff=4000,model_dir='INV_SSA_ModelT',SSA=True,sign='over')
x_cutoff_SSA_slow,y_cutoff_SSA_slow,vsurfini_cutoff_SSA_slow,ind_cutoff_grid_slow,ind_cutoff_SSA_slow  = inverselib.get_velocity_cutoff(glacier,\
        velocity_cutoff=1000,model_dir='INV_SSA_ModelT',SSA=True,sign='under')

# Get ice front positions
xflow, yflow, zflow, dflow = glaclib.load_flowline(glacier)
term_pos, term_time = icefrontlib.distance_along_flowline(
    xflow, yflow, dflow, glacier)

# Some constants
rho_i = 917.
rho_sw = 1025.
g = 9.8
Пример #5
0
try:
    hole1 = np.loadtxt(DIR_FS_ModelT+"inputs/mesh_hole1.dat")
    hole2 = np.loadtxt(DIR_FS_ModelT+"inputs/mesh_hole2.dat")
    holes=[hole1,hole2]
except:
    holes = []


# Plot options
vmin = -75
vmax = 75
cmap = matplotlib.colors.LinearSegmentedColormap.from_list('map',['#400000','#800000','#a50026','#d73027','#f46d43','#fdae61',\
    '#ffffff','#abd9e9','#74add1','#4575b4','#313695','#191970','#000059'])

# Get indices where velocity is always greater than the cutoff value
x_cutoff,y_cutoff,vsurfini_cutoff,ind_cutoff_grid,ind_cutoff_SSA  = inverselib.get_velocity_cutoff(glacier,velocity_cutoff=cutoff,SSA=True)
x_cutoff,y_cutoff,vsurfini_cutoff,ind_cutoff_grid,ind_cutoff_FS  = inverselib.get_velocity_cutoff(glacier,velocity_cutoff=cutoff,SSA=False)

# Set up figure
if glacier == 'Kanger':
    height = 6.9
    cbar_z = 0.065
    cbar_height = 0.03
    top_z = 0.96
    bot_z = 0.105
elif glacier == 'Helheim':
    height = 9.55
    cbar_z = 0.045
    cbar_height = 0.022
    top_z = 0.97
    bot_z = 0.075
Пример #6
0
try:
    hole1 = np.loadtxt(DIR_FS_ModelT + "inputs/mesh_hole1.dat")
    hole2 = np.loadtxt(DIR_FS_ModelT + "inputs/mesh_hole2.dat")
    holes = [hole1, hole2]
except:
    holes = []

# Plot options
vmin = -75  # min residual
vmax = 75  # max residual
cmap = matplotlib.colors.LinearSegmentedColormap.from_list('map',['#400000','#800000','#a50026','#d73027','#f46d43','#fdae61',\
    '#ffffff','#abd9e9','#74add1','#4575b4','#313695','#191970','#000059'])

# Get indices where velocity is always greater than the cutoff value
# For SSA-CT and SSA-MT
x_cutoff,y_cutoff,vsurfini_cutoff,ind_cutoff_grid,ind_cutoff_SSA  = inverselib.get_velocity_cutoff(glacier,velocity_cutoff=cutoff,\
        SSA=True,model_dir='INV_SSA_ModelT')
# For FS-CT and FS-MT (no indices may vary from SSA-CT and SSA-MT)
x_cutoff,y_cutoff,vsurfini_cutoff,ind_cutoff_grid,ind_cutoff_FS  = inverselib.get_velocity_cutoff(glacier,velocity_cutoff=cutoff,\
        SSA=False,model_dir='INV_FS_ModelT')
ind_cutoffs = [ind_cutoff_FS, ind_cutoff_FS, ind_cutoff_SSA, ind_cutoff_SSA]

# Set up figure
if glacier == 'Kanger':
    height = 6.0
    cbar_z = 0.065
    cbar_height = 0.02
    top_z = 0.96
    bot_z = 0.095
elif glacier == 'Helheim':
    height = 8.2
    cbar_z = 0.055