本文整理汇总了Python中nansat.Nansat.get_corners方法的典型用法代码示例。如果您正苦于以下问题:Python Nansat.get_corners方法的具体用法?Python Nansat.get_corners怎么用?Python Nansat.get_corners使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nansat.Nansat
的用法示例。
在下文中一共展示了Nansat.get_corners方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_write_fig_tif
# 需要导入模块: from nansat import Nansat [as 别名]
# 或者: from nansat.Nansat import get_corners [as 别名]
def test_write_fig_tif(self):
n = Nansat(self.test_file_arctic)
tmpfilename = os.path.join(ntd.tmp_data_path,
'nansat_write_fig_tif.tif')
n.write_figure(tmpfilename)
nn = Nansat(tmpfilename)
# Asserts that the basic georeference (corners in this case) is still
# present after opening the image
self.assertTrue(np.allclose(n.get_corners(), nn.get_corners()))
示例2: Nansat
# 需要导入模块: from nansat import Nansat [as 别名]
# 或者: from nansat.Nansat import get_corners [as 别名]
fileName = 'MER_FRS_1PNEPA20100401_154249_000001972088_00140_42278_0585.N1.nc'
# create Nansat object
n = Nansat(iPath + fileName)
# list bands and georeference of the object
print n
# Reprojected image into Lat/Lon WGS84 (Simple Cylindrical) projection
# 1. Cancel previous reprojection
# 2. Get corners of the image and the pixel resolution
# 3. Create Domain with stereographic projection, corner coordinates and resolution 1000m
# 4. Reproject
# 5. Write image
n.reproject() # 1.
lons, lats = n.get_corners() # 2.
pxlRes = distancelib.getPixelResolution(array(lats), array(lons), n[1])
pxlRes = array(pxlRes)*360/40000 # great circle distance
srsString = "+proj=latlong +datum=WGS84 +ellps=WGS84 +no_defs"
#~ extentString = '-lle %f %f %f %f -ts 3000 3000' % (min(lons), min(lats), max(lons), max(lats))
extentString = '-lle %f %f %f %f -tr %f %f' % (min(lons), min(lats), \
max(lons), max(lats), pxlRes[1], pxlRes[0])
d = Domain(srs=srsString, ext=extentString) # 3.
print d
n.reproject(d) # 4.
# get array with watermask (landmask) b
# it must be done after reprojection!
# 1. Get Nansat object with watermask
# 2. Get array from Nansat object. 0 - land, 1 - water
#wm = n.watermask(mod44path='/media/magDesk/media/SOLabNFS/store/auxdata/coastline/mod44w/')
示例3: main
# 需要导入模块: from nansat import Nansat [as 别名]
# 或者: from nansat.Nansat import get_corners [as 别名]
def main( argv=None ):
year = '2012'
useMask = False
if argv is None:
argv = sys.argv
if argv is None:
print ( "Please specify the path/year to the asar folder! \n")
return
# Parse arguments
try:
opts, args = getopt.getopt(argv,"hi:o:",["year=","oPath=","iPath=","useMask="])
except getopt.GetoptError:
print 'readASAR.py -year <year> ...'
sys.exit(2)
for opt, arg in opts:
if opt == '-h':
print 'readASAR.py -year <year> ...'
sys.exit()
elif opt in ("-year", "--year"):
year = arg
elif opt in ("-oPath", "--oPath"):
oPath = arg
elif opt in ("-iPath", "--iPath"):
iPath = arg
elif opt in ("-useMask", "--useMask"):
useMask = arg
oPath = '/media/SOLabNFS2/tmp/roughness/' + year + '/'
iPath = '/media/SOLabNFS2/store/satellite/asar/' + year + '/'
if not os.path.exists(oPath):
os.makedirs(oPath)
dirNames=os.listdir(iPath)
for dirName in dirNames:
fileNames=os.listdir(iPath+dirName)
for fileName in fileNames:
figureName = oPath + fileName[0:27] + '/' + fileName + '_proj.png'
kmlName = oPath + fileName[0:27] + '/' + fileName + '.kml'
if not os.path.exists(oPath + fileName[0:27] + '/'):
os.makedirs(oPath + fileName[0:27] + '/')
if os.path.isfile(kmlName):
print "%s already processed" % (fileName)
continue
else:
print "%s" % (fileName)
# try to create Nansat object
try:
n = Nansat(iPath + dirName + '/' + fileName, mapperName='asar', logLevel=27)
except Exception as e:
print "Failed to create Nansat object:"
print str(e)
os.rmdir(oPath + fileName[0:27] + '/' )
continue
#~ Get the bands
raw_counts = n[1]
inc_angle = n[2]
#~ NICE image (roughness)
pol = n.bands()[3]['polarization']
if pol == 'HH':
ph = (2.20495, -14.3561e-2, 11.28e-4)
sigma0_hh_ref = exp( ( ph[0]+inc_angle*ph[1]+inc_angle**2*ph[2])*log(10) )
roughness = n[3]/sigma0_hh_ref
elif pol == 'VV':
pv = (2.29373, -15.393e-2, 15.1762e-4)
sigma0_vv_ref = exp( ( pv[0]+inc_angle*pv[1]+inc_angle**2*pv[2])*log(10) )
roughness = n[3]/sigma0_vv_ref
#~ Create new band
n.add_band(bandID=4, array=roughness, \
parameters={'name':'roughness', \
'wkv': 'surface_backwards_scattering_coefficient_of_radar_wave', \
'dataType': 6})
# Reproject image into Lat/Lon WGS84 (Simple Cylindrical) projection
# 1. Cancel previous reprojection
# 2. Get corners of the image and the pixel resolution
# 3. Create Domain with stereographic projection, corner coordinates 1000m
# 4. Reproject
# 5. Write image
n.reproject() # 1.
lons, lats = n.get_corners() # 2.
# Pixel resolution
#~ pxlRes = distancelib.getPixelResolution(array(lats), array(lons), n.shape())
#~ pxlRes = array(pxlRes)*360/40000 # great circle distance
pxlRes = array(distancelib.getPixelResolution(array(lats), array(lons), n.shape(), 'deg'))
ipdb.set_trace()
#.........这里部分代码省略.........
示例4: Nansat
# 需要导入模块: from nansat import Nansat [as 别名]
# 或者: from nansat.Nansat import get_corners [as 别名]
# create Nansat object
n = Nansat(iPath + fileName, mapperName='ASAR')
#n = Nansat(iPath + fileName)
# list bands and georeference of the object
print n
# get dictionary with all bands metadata
print n.bands()
# get size of the object (Y and X dimensions, to follow Numpy style)
print n.shape()
# get list with coordinates of the object corners
print n.get_corners()
# get lists with coordinates of the object borders
print n.get_border()
raw_counts = n[1]
inc_angle = n[2]
#~ sigma0 = n[3]
sigma0 = raw_counts**2.0 * sin(deg2rad(inc_angle))
sigma0 = 10*log10(sigma0)
n.add_band(bandID=4, array=sigma0)
# 1. Remove speckle noise (using Lee-Wiener filter)
speckle_filter('wiener', 7)