本文整理汇总了Python中nansat.Nansat.write_kml方法的典型用法代码示例。如果您正苦于以下问题:Python Nansat.write_kml方法的具体用法?Python Nansat.write_kml怎么用?Python Nansat.write_kml使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nansat.Nansat
的用法示例。
在下文中一共展示了Nansat.write_kml方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: borders
# 需要导入模块: from nansat import Nansat [as 别名]
# 或者: from nansat.Nansat import write_kml [as 别名]
# make RGB image from bands 6,5,2 with brightness correction
n.write_figure(oPath + fileName + '_rgb.png', bands=[6,5,2], clim='hist', ratio=0.7, logarithm=True, gamma=3)
# make indexed image with legend
n.write_figure(oPath + fileName + '_legend.png', bands='radiance_900', clim='hist', ratio=0.7, legend=True, titleString='NANSAT Tutorial', fontSize=40)
# make small preview in three steps:
# 1. Reduce size of the Nansat object ten times
# 2. Make simple grayscaled image with brightness correction
# 3. Resize back to original resolution
n.resize(0.1)
n.write_figure(oPath + fileName + '_preview.png', clim='hist', ratio=0.7, cmapName='gray')
n.resize()
# make KML file with image borders (to be opened in Googe Earth)
n.write_kml(kmlFileName=oPath + fileName + '_preview.kml')
# make image with map of the file location
n.write_map(oPath + fileName + '_map.png')
# Make image, reprojected onto map of Northern Europe in three steps:
# 1. Create Domain object. It describes the desired grid of reprojected image:
# projection, resolution, size, etc. In this case it is geographic projection;
# -10 - 30 E, 50 - 70 W; 2000 x 2000 pixels
# 2. Reproject the Nansat object
# 3. Make simple image
d = Domain("+proj=latlong +datum=WGS84 +ellps=WGS84 +no_defs", "-lle -10 50 30 70 -ts 2000 2000")
print d
n.reproject(d)
n.write_figure(oPath + fileName + '_pro_latlon.png')
示例2: object
# 需要导入模块: from nansat import Nansat [as 别名]
# 或者: from nansat.Nansat import write_kml [as 别名]
wmArray = wm[1]
n.write_figure(oFileName + '_proj.png', clim='hist', bands=[3], \
mask_array=wmArray, mask_lut={0: [204, 153, 25]}) # 5.
# write figure with lat/lon grid
# 1. Get lat/lon arrays from Nansat object (may take some time)
# 2. Make figure with lat/lon grids
lonGrid, latGrid = n.get_geolocation_grids()
n.write_figure(oFileName + '_latlon.png', bands=[1], \
latGrid=latGrid, lonGrid=lonGrid, \
latlonGridSpacing=10, latlonLabels=10, \
mask_array=wmArray, mask_lut={0: [0, 0, 0]})
# make KML file with image borders (to be opened in Googe Earth)
n.write_kml(kmlFileName=oFileName + '_preview.kml')
# make image with map of the file location
n.write_map(oFileName + '_map.png')
# Reprojected image into stereographic projection
# 1. Cancel previous reprojection
# 2. Get corners of the image
# 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.
meanLon = sum(lons, 0.0) / 4.
meanLat = sum(lats, 0.0) / 4.
srsString = "+proj=stere +lon_0=%f +lat_0=%f +k=1 +ellps=WGS84 +datum=WGS84 +no_defs" % (meanLon, meanLat)