Example #1
0
)
parser.add_argument(
    "-o", "--output_filename", dest="out_file", help="Name of the output shape file", default="interface.shp"
)
parser.add_argument("-v", "--variable", dest="dst_fieldname", help="Name of variable to use", default="usurf")

options = parser.parse_args()
filename = options.FILE[0]
epsg = options.epsg
levels = np.array(options.levels.split(","), dtype=float)
shp_filename = options.out_file
ts_fieldname = "timestamp"
dst_fieldname = options.dst_fieldname

nc = NC(filename, "r")
xdim, ydim, zdim, tdim = ppt.get_dims(nc)

if tdim:
    time = nc.variables[tdim]
    time_units = time.units
    time_calendar = time.calendar
    cdftime = utime(time_units, time_calendar)
    timestamps = cdftime.num2date(time[:])
    has_time = True
else:
    tdim = None
nc.close()

src_ds = gdal.Open("NETCDF:{}:{}".format(filename, dst_fieldname))

# Get Memory Driver
Example #2
0
nc_b = NC(background_file, 'r')

# RCM p values
 
p1 = 0.0720
p2 = 2.2484
p3 = 0.0016
p4 = 0.1011

try:
    os.remove(outfile)
except OSError:
    pass
nc = NC(outfile, 'w')

xdim_a, ydim_a, zdim_a, tdim_a = ppt.get_dims(nc_a)
xdim_b, ydim_b, zdim_b, tdim_b = ppt.get_dims(nc_b)

assert xdim_a == xdim_b
assert ydim_a == ydim_b

xdim = xdim_a
ydim = ydim_a
tdim = 'time'

nx = len(nc_a.dimensions[xdim_a])
ny = len(nc_a.dimensions[ydim_b])

start = -5
end = 100
nt = end - start
Example #3
0
bmelt_1 = options.bmelt_1 * ice_density
mask = options.mask

infile = args[0]

nc = NC(infile, "a")

lon_0 = -45
# Jakobshavn
lat_0 = 69
# Petermann
lat_1 = 81

p = ppt.get_projection_from_file(nc)

xdim, ydim, zdim, tdim = ppt.get_dims(nc)

x0, y0 = p(lon_0, lat_0)
x1, y1 = p(lon_0, lat_1)

# bmelt = a*y + b
a = (bmelt_1 - bmelt_0) / (y1 - y0)
b = bmelt_0 - a * y0

x = nc.variables[xdim]
y = nc.variables[ydim]

X, Y = np.meshgrid(x, y)

nc = NC(infile, "a")
nc_b = NC(background_file, "r")

# RCM p values

p1 = 0.0720
p2 = 2.2484e3
p3 = 0.0016
p4 = 0.1011

try:
    os.remove(outfile)
except OSError:
    pass
nc = NC(outfile, "w")

xdim_a, ydim_a, zdim_a, tdim_a = ppt.get_dims(nc_dem)
xdim_b, ydim_b, zdim_b, tdim_b = ppt.get_dims(nc_b)

assert xdim_a == xdim_b
assert ydim_a == ydim_b

xdim = xdim_a
ydim = ydim_a
tdim = "time"

nx = len(nc_dem.dimensions[xdim_a])
ny = len(nc_dem.dimensions[ydim_b])

start = -10
end = 100
nt = end - start