示例#1
0
def cut(lat,lon):
	import numpy as np
	root, is_new = nc.open(localpath+"/dem.nc")
	dem = nc.getvar(root, 'dem', 'i2', lat.dimensions)
	x, y = p.pixels_from_coordinates(lat[:], lon[:], dem.shape[0], dem.shape[1])
	# In the transformation the 'y' dimension is twisted because the map is inverted.
	result = p.transform_data(dem,x,dem.shape[0] - y)
	nc.close(root)
	return result, x, y
示例#2
0
def project_coordinates(lat, lon):
	shape = get_month(1).shape
	return p.pixels_from_coordinates(lat, lon, shape[0], shape[1])
示例#3
0
def project_coordinates(lat, lon):
    ds = gdal.Open(path + "/tifs/01_longlat_wgs84.tif")
    return p.pixels_from_coordinates(lat, lon, ds.RasterYSize, ds.RasterXSize)