Esempio n. 1
0
import cslvr as cs
import numpy as np

out_dir = '../dump/meshes/cslvr/'
mesh_name = 'nioghalvfjerdsbrae'

#===============================================================================
# data preparation :

# get the togography data :
bedmachine = cs.DataFactory.get_bedmachine()
dbm = cs.DataInput(bedmachine)

# get the velocity data :
#rignot     = cs.DataFactory.get_rignot()
#drg        = cs.DataInput(rignot)
mouginot = cs.DataFactory.get_mouginot()
dmg = cs.DataInput(mouginot)

#drg.change_projection(dbm)

# calculate surface velocity magnitude :
U_ob = np.sqrt(dmg.data['vx']**2 + dmg.data['vy']**2 + 1e-16)
dmg.data['U_ob'] = U_ob

#===============================================================================
# form field from which to refine :
dmg.rescale_field('U_ob', 'ref', umin=1000.0, umax=300000.0, inverse=True)

# eliminate just the edge of the mask so that we can properly interpolate
# the geometry to the terminus :
Esempio n. 2
0
#===============================================================================
# data preparation :
out_dir = 'dump/meshes/'
mesh_name = 'nioghalvfjerdsbrae_3D'

#===============================================================================
# use issm to create mesh for 79 N Glacier :
cs.print_text('::: issm -- constructing mesh :::', 'red')

# instantiate a generic model instance :
md = im.model()
md.miscellaneous.name = 'Nioghalvfjerdsbrae'

# use cslvr to get the velocity data from which to refine :
mouginot = cs.DataFactory.get_mouginot()
dmg = cs.DataInput(mouginot)

# define the geometry of the simulation :
md = im.triangle(md, out_dir + mesh_name + '.exp', 50000)

# change data type to that required by InterpFromGridToMesh() :
x1 = dmg.x.astype('float64')
y1 = dmg.y.astype('float64')
velx = dmg.data['vx'].astype('float64')
vely = dmg.data['vy'].astype('float64')

# calculate the velocity magnitude :
vel = np.sqrt(velx**2 + vely**2)

# interpolate the data onto the issm mesh :
vx = im.InterpFromGridToMesh(x1, y1, velx, md.mesh.x, md.mesh.y, 0)[0]
Esempio n. 3
0
import issm  as im
import cslvr as cs
import numpy as np

#===============================================================================
# data preparation :
out_dir   = 'dump/meshes/'
mesh_name = 'nioghalvfjerdsbrae_3D'

# get the togography data :
bedmachine = cs.DataFactory.get_bedmachine()
dbm        = cs.DataInput(bedmachine)

#===============================================================================
# generate the contour :
m = cs.MeshGenerator(dbm, mesh_name, out_dir)

#m.create_contour('mask', zero_cntr=0.0001, skip_pts=0)
m.create_contour('H', zero_cntr=50, skip_pts=200) # 50 meter thickness contour
m.eliminate_intersections(dist=200)               # eliminate interscting lines

#===============================================================================
# a box region :
#x1 = -500000; y1 = -2190000
#x2 = -150000; y2 = -2320000
#
#new_cont = np.array([[x1, y1],
#                     [x2, y1],
#                     [x2, y2],
#                     [x1, y2],
#                     [x1, y1]])
Esempio n. 4
0
}
load_dict = im.loadvars(out_dir + 'issm_nio.shelve', var_dict)

md.mesh = load_dict['md.mesh']
md.inversion.vx_obs = load_dict['md.inversion.vx_obs']
md.inversion.vy_obs = load_dict['md.inversion.vy_obs']
md.inversion.vel_obs = load_dict['md.inversion.vel_obs']

#===============================================================================
# collect the raw data :
searise = cs.DataFactory.get_searise()
bedmach = cs.DataFactory.get_bedmachine(thklim=1.0)
mouginot = cs.DataFactory.get_mouginot()

# create data objects to use with varglas :
dsr = cs.DataInput(searise)
dbm = cs.DataInput(bedmach)
dmg = cs.DataInput(mouginot)

# change the projection of all data to be the same as the mesh :
#dbm.interpolate_from_di(dsr, 'T', 'T', order=3)

#===============================================================================
# set grounded/floating ice mask :
cs.print_text('::: issm -- setting mask :::', 'red')

mask = im.InterpFromGridToMesh(dbm.x, dbm.y, dbm.data['mask'], md.mesh.x,
                               md.mesh.y, 0)[0]

# issm specifies floating ice as -1 :
mask = np.round(mask).astype('int')