valid_f = Function(Q) valid_f_v = valid_f.vector().array() valid_f_v[valid] = 1.0 valid_f.vector().set_local(valid_f_v) valid_f.vector().apply('insert') rignot = DataFactory.get_gre_rignot() drg = DataInput(rignot, gen_space=False) betaMax = 200.0 ini_f = Function(Q) ini_f.vector()[:] = ini plotIce(drg, ini_f, name='ini', direc='images/stats/' + file_n, cmap='gist_yarg', scale='log', numLvls=12, tp=False, tpAlpha=0.5, show=False, umin=1.0, umax=betaMax) Ubar_avg_f = Function(Q) Ubar_avg_f.vector()[:] = Ubar_avg plotIce(drg, Ubar_avg_f, name='Ubar_avg', direc='images/stats/' + file_n, title=r'$\Vert \mathbf{\bar{u}}_{\bar{bv}} \Vert$', cmap='gist_yarg', scale='log', numLvls=12, tp=False, tpAlpha=0.5, show=False, umin=1.0, umax=4000.0) plotIce(drg, valid_f, name='valid', direc='images/stats/' + file_n, cmap='gist_yarg', scale='bool', numLvls=12, tp=False, tpAlpha=0.5, show=False) #=============================================================================== # cell declustering :
a_resi_f = Function(a_Q) a_yhat_f.vector()[a_valid] = yhat[a_conv] a_resi_f.vector()[a_valid] = resid[a_conv] g_yhat_f = Function(g_Q) g_resi_f = Function(g_Q) g_yhat_f.vector()[g_valid] = yhat[g_conv] g_resi_f.vector()[g_valid] = resid[g_conv] plotIce(dm, a_yhat_f, name='GLM_beta', direc=a_fn, title=r'$\hat{\beta}$', cmap='gist_yarg', scale='log', extend='max', umin=1.0, umax=betaMax, numLvls=12, tp=False, tpAlpha=0.5, show=False) plotIce(dm, a_resi_f, name='GLM_resid', direc=a_fn, title=r'$d$', cmap='RdGy', scale='lin', extend='both',
yhat_f = Function(Q) y_f = Function(Q) resi_f = Function(Q) yhat_f.vector()[valid] = yhat y_f.vector()[valid] = y resi_f.vector()[valid] = resid plotIce(dm, yhat_f, name='GLM_beta', direc='images/stats/' + file_n, title=r'$\hat{\beta}$', cmap='gist_yarg', scale='log', umin=1.0, umax=betaMax, numLvls=12, tp=False, tpAlpha=0.5, show=False) plotIce(dm, y_f, name='beta', direc='images/stats/' + file_n, title=r'$\beta$', cmap='gist_yarg', scale='log', umin=1.0,
bamber = DataFactory.get_bamber(thklim) # load a mesh : #mesh = MeshFactory.get_greenland_2D_1H() mesh = Mesh('dump/meshes/greenland_2D_1H_mesh.xml.gz') # create data objects to use with varglas : dbm = DataInput(bamber, mesh=mesh) model = D2Model(mesh) model.init_Ubar(in_dir + 'Ubar.xml') plotIce(dbm, model.Ubar, name='Ubar', direc=in_dir + 'plot/', title=r'$\bar{\mathbf{u}}$', cmap='gist_yarg', scale='log', numLvls=12, tp=False, tpAlpha=0.5, umin=1.0, umax=4000, show=False) #def plotIce(di, u, name, direc, title='', cmap='gist_yarg', scale='lin', # umin=None, umax=None, numLvls=12, tp=False, tpAlpha=0.5, # extend='neither', show=True):
mask = logical_or(m1, m2) # create data objects to use with varglas : dsr = DataInput(searise, gen_space=False) dbm = DataInput(bamber, gen_space=False) drg = DataInput(rignot, gen_space=False) dbm.data['M'] = mask plotIce(dbm, 'M', name='M', direc='greenland/', title='$M$', cmap='gist_yarg', scale='lin', umin=None, umax=None, numLvls=3, tp=False, tpAlpha=0.5, extend='neither', show=False) #plotIce(dsr, 'adot', name='adot', direc='greenland/', title='$\dot{a}$', # cmap='gist_yarg', scale='lin', umin=None, umax=None, # numLvls=12, tp=False, tpAlpha=0.5, extend='neither', show=True) # #plotIce(dsr, 'T', name='T', direc='greenland/', title='$T$', # cmap='gist_yarg', scale='lin', umin=None, umax=None, # numLvls=12, tp=False, tpAlpha=0.5, extend='neither', show=True) #
# extend='both', show=False) #plotIce(dm, Ubar50, name='Ubar_bv_50', direc='images/model/', cmap='gist_yarg', # title=r'$\Vert\mathbf{\bar{u}}_{bv50}\Vert$', scale='log', # umin=1.0, umax=4000, numLvls=12, tp=False, tpAlpha=0.5, # extend='both', show=False) #plotIce(dm, U_ob, name='U_ob', direc='images/model/', cmap='gist_yarg', # title=r'$\Vert \mathbf{u}_{ob} \Vert$', scale='log', # umin=1.0, umax=4000, numLvls=12, tp=False, tpAlpha=0.5, # extend='both', show=False) plotIce(dm, beta, name='beta', direc='images/model/', cmap='gist_yarg', title=r'$\beta$', scale='lin', umin=0.0, umax=200, numLvls=12, tp=False, tpAlpha=0.5, extend='max', show=False) #plotIce(dm, Mb, name='Mb', direc='images/model/', cmap='gist_yarg', # title=r'$M_B$', scale='log', umin=0.003, umax=1.0, # numLvls=13, tp=False, tpAlpha=0.5, extend='both', show=False) #plotIce(dm, tau_id, name='tau_id', direc='images/model/', cmap='RdGy', # title=r'$\tau_{id}$', scale='lin', umin=-1e5, umax=1e5, # numLvls=13, tp=False, tpAlpha=0.5, extend='both', show=False) #plotIce(dm, tau_jd, name='tau_jd', direc='images/model/', cmap='RdGy', # title=r'$\tau_{jd}$', scale='lin', umin=-1e5, umax=1e5, # numLvls=13, tp=False, tpAlpha=0.5, extend='both', show=False)
vs_v = vs.vector().array() ws_v = ws.vector().array() Us_mag = sqrt(us_v**2 + vs_v**2 + ws_v**2 + 1e-16) Us_mag_f = Function(Q) Us_mag_f.vector()[:] = Us_mag measures = DataFactory.get_ant_measures(res=900) dm = DataInput(measures, gen_space=False) plotIce(dm, beta, name='beta', direc=out_dir, cmap='gist_yarg', title=r'$\beta$', scale='lin', umin=0.0, umax=200, numLvls=12, tp=False, tpAlpha=0.5, extend='max', show=False) plotIce(dm, Us_mag_f, name='Us', direc=out_dir, cmap='gist_yarg', title=r'$\Vert\mathbf{u}_S\Vert$', scale='log', umin=1.0,
#for i in y_valid: # for j in x_valid: # dbm.data['H'][i,j] = 1.0 #plotIce(dbm, 'mask', name='mask', direc='images/data/', cmap='gist_yarg', # title=r'', scale='lin', umin=None, umax=None, numLvls=num_mask) # #plotIce(dbm, 'gM', name='gM', direc='images/data/', cmap='gist_yarg', # title=r'', scale='lin', umin=None, umax=None, numLvls=25) # #plotIce(dbm, 'ref', name='ref', direc='images/data/', cmap='gist_yarg', # title=r'', scale='lin', umin=None, umax=None, numLvls=3) # plotIce(dbm, 'H', name='H', direc='images/data/', cmap='gist_yarg', title=r'$H$', scale='lin', umin=None, umax=None, numLvls=25) #plotIce(dbm, 'S', name='S', direc='images/data/', cmap='gist_yarg', # title=r'$S$', scale='lin', umin=0.0, umax=None, numLvls=25) # #plotIce(dsr, 'U_sar', name='U_ob', direc='images/data/', cmap='gist_yarg', # title=r'$\Vert \mathbf{u}_{ob} \Vert$', scale='log', # umin=1.0, umax=4000, numLvls=25)
from varglas import * from varglas.helper import plotIce thklim = 10.0 in_dir = 'dump/balance_velocity/' # collect the raw data : bamber = DataFactory.get_bamber(thklim) # load a mesh : #mesh = MeshFactory.get_greenland_2D_1H() mesh = Mesh('dump/meshes/greenland_2D_1H_mesh.xml.gz') # create data objects to use with varglas : dbm = DataInput(bamber, mesh=mesh) model = D2Model(mesh) model.init_Ubar(in_dir + 'Ubar.xml') plotIce(dbm, model.Ubar, name='Ubar', direc=in_dir + 'plot/', title=r'$\bar{\mathbf{u}}$', cmap='gist_yarg', scale='log', numLvls=12, tp=False, tpAlpha=0.5, umin=1.0, umax=4000, show=False) #def plotIce(di, u, name, direc, title='', cmap='gist_yarg', scale='lin', # umin=None, umax=None, numLvls=12, tp=False, tpAlpha=0.5, # extend='neither', show=True):
File('antarctica/dump/bed/balance_water/q.xml') >> a_qbar #=============================================================================== # plotting : bedmap1 = DataFactory.get_bedmap1(thklim=1.0) d1 = DataInput(bedmap1, mesh=a_mesh) cmap = 'gist_earth' cmap = 'RdYlGn' cmap = 'RdGy' cmap = 'gist_gray' cmap = 'Purples' cmap = 'Reds' cmap = 'Oranges' plotIce(d1, 'B', '.', 'gist_yarg', scale='lin', name=r'$B$', numLvls=12, tp=False, tpAlpha=0.5) #=============================================================================== a_dSdx = project(a_S.dx(0), a_Q) a_dSdy = project(a_S.dx(1), a_Q) a_dBdx = project(a_B.dx(0), a_Q) a_dBdy = project(a_B.dx(1), a_Q) # vectors : a_beta_v = a_beta.vector().array() a_S_v = a_S.vector().array() a_B_v = a_B.vector().array() a_adot_v = a_adot.vector().array() a_qgeo_v = a_qgeo.vector().array()
model.config['model_order'] = 'SSA' model.set_mesh(mesh) #model.set_surface_and_bed(S, B) model.initialize_variables() model.init_U_ob(u, v) #plotIce(dbm, 'mask', name='mask', direc='images/data/', cmap='gist_yarg', # title=r'', scale='lin', umin=None, umax=None, numLvls=num_mask) # #plotIce(dbm, 'ref', name='ref', direc='images/data/', cmap='gist_yarg', # title=r'', scale='lin', umin=None, umax=None, numLvls=3) # #plotIce(dbm, 'H', name='H', direc='images/data/', cmap='gist_yarg', # title=r'$H$', scale='lin', umin=None, umax=None, numLvls=25) # #plotIce(dbm, 'S', name='S', direc='images/data/', cmap='gist_yarg', # title=r'$S$', scale='lin', umin=0.0, umax=None, numLvls=25) # plotIce(dbm, model.U_ob, name='U_ob', direc='images/data/', cmap='gist_yarg', title=r'$\Vert \mathbf{u}_{ob} \Vert$', scale='log', umin=1.0, umax=4000, numLvls=25, tp=True)
ubar_v = ubar.vector().array() vbar_v = vbar.vector().array() Ubar_mag = sqrt(ubar_v**2 + vbar_v**2 + 1e-16) Ubar_mag_f = Function(Q) Ubar_mag_f.vector()[:] = Ubar_mag etabar_v = etabar.vector().array() etabar_v /= 1e6 etabar.vector()[:] = etabar_v rignot = DataFactory.get_gre_rignot() drg = DataInput(rignot, gen_space=False) plotIce(drg, mask, name='mask', direc='images/model/', cmap='gist_yarg', title=r'', scale='bool', umin=0.0, umax=1.0, numLvls=12, tp=False, tpAlpha=0.5, extend='neither', show=False) plotIce(drg, S, name='S', direc='images/model/', cmap='gist_yarg', title=r'$S$', scale='lin', umin=0, umax=None, numLvls=12, tp=False, tpAlpha=0.5, extend='neither', show=False) plotIce(drg, B, name='B', direc='images/model/', cmap='gist_yarg', title=r'$B$', scale='lin', umin=-1000, umax=None, numLvls=12, tp=False, tpAlpha=0.5, extend='min', show=False) plotIce(drg, gradS, name='gradS', direc='images/model/', cmap='gist_yarg', title=r'$\Vert \nabla S \Vert$', scale='log', umin=1e-3, umax=1.0, numLvls=12, tp=False, tpAlpha=0.5, extend='both', show=False) plotIce(drg, gradB, name='gradB', direc='images/model/', cmap='gist_yarg', title=r'$\Vert \nabla B \Vert$', scale='log', umin=1e-3, umax=1.0, numLvls=12, tp=False, tpAlpha=0.5, extend='both', show=False) plotIce(drg, H, name='H', direc='images/model/', cmap='gist_yarg', title=r'$H$', scale='lin', umin=None, umax=None,