Ejemplo n.º 1
0
# -*- coding: utf-8 -*-
"""
Create a uniform mesh of Antarctica for plotting. 
"""

from varglas.utilities         import DataInput, MeshGenerator
from varglas.data.data_factory import DataFactory
from pylab                     import *

thklim = 0
# create meshgrid for contour :
bedmap2 = DataFactory.get_bedmap2()
# process the data :
dbm = DataInput(bedmap2, gen_space=False)
dbm.set_data_val("H", 32767, thklim)

m = MeshGenerator(dbm, 'mesh', '')

m.create_contour('H', 0.0, 5)
m.eliminate_intersections(dist=20)

m.write_gmsh_contour(1000, boundary_extend=False)
m.add_edge_attractor(1)

#field, ifield, lcMin, lcMax, distMin, distMax
m.add_threshold(2, 1, 3000, 3000, 1, 100000)
m.finish(4)

#m.create_2D_mesh('mesh') #FIXME: fails
#m.convert_msh_to_xml('mesh', 'mesh')
from varglas.data.data_factory import DataFactory
from varglas.utilities import DataInput, MeshGenerator
from numpy import *
from mpl_toolkits.basemap import Basemap

# Get the Antarctica data sets
bedmap2 = DataFactory.get_bedmap2()
db2 = DataInput(bedmap2)

# Get the grounding line by eliminating the shelves
db2.set_data_val('mask',1,127)

# Create a grounding line countour
mg = MeshGenerator(db2, 'mesh', '')
mg.create_contour('mask', 10, skip_pts=2)
mg.eliminate_intersections(dist=20)
cont = mg.longest_cont

# Convert (x,y) coordinates to (lon,lat)
cont_lons, cont_lats = db2.p(cont[:,0], cont[:,1], inverse = True)

# Convert (x,y) coordinates to (lon,lat)
cont_lons, cont_lats = db2.p(cont[:,0], cont[:,1], inverse = True)

# Convert to basemap coordinates
lat_0  = '-90'
lat_ts = '-71'
lon_0  = '0'
height = 3333500*2
width = 3333500*2
Ejemplo n.º 3
0
@author: jake
"""

from pylab import *
from varglas.data.data_factory import DataFactory
from varglas.utilities import DataInput, MeshGenerator
from numpy import *

# Get the Antarctica data sets
bedmap2 = DataFactory.get_bedmap2(thklim = 200)

# Create a countour of the continent - without the ice shelves
db2 = DataInput(bedmap2)
db2.set_data_val('mask',1,127)
mg = MeshGenerator(db2, 'mesh', '')
mg.create_contour('mask', 0, skip_pts=4)
mg.eliminate_intersections(dist=40)
# Get the longest contour, which will be the coastline 
cont = mg.longest_cont

# Load the glacier data
glacier_data = loadtxt('glacier_data.out', delimiter = '|', dtype = 'str')
names = array(glacier_data[:,0], dtype = 'str')
lons = array(glacier_data[:,1], dtype = 'f')
lats = array(glacier_data[:,2], dtype = 'f')

# Convert lons and lats to x, y coordinates
x, y = db2.p(lons,lats)

# Next, eliminate glaciers that are too far from the coast