本文整理汇总了Python中nansat.vrt.VRT.get_resized_vrt方法的典型用法代码示例。如果您正苦于以下问题:Python VRT.get_resized_vrt方法的具体用法?Python VRT.get_resized_vrt怎么用?Python VRT.get_resized_vrt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nansat.vrt.VRT
的用法示例。
在下文中一共展示了VRT.get_resized_vrt方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from nansat.vrt import VRT [as 别名]
# 或者: from nansat.vrt.VRT import get_resized_vrt [as 别名]
#.........这里部分代码省略.........
degrees to get the "satellite" heading.
'''
if str(passDirection).upper() == 'DESCENDING':
sat_heading = initial_bearing(lon[:, :-1], lat[:, :-1],
lon[:, 1:], lat[:, 1:]) + 90
elif str(passDirection).upper() == 'ASCENDING':
sat_heading = initial_bearing(lon[:, 1:], lat[:, 1:],
lon[:, :-1], lat[:, :-1]) + 90
else:
print 'Can not decode pass direction: ' + str(passDirection)
# Calculate SAR look direction
look_direction = sat_heading + antennaPointing
# Interpolate to regain lost row
look_direction = np.mod(look_direction, 360)
look_direction = scipy.ndimage.interpolation.zoom(
look_direction, (1, 11./10.))
# Decompose, to avoid interpolation errors around 0 <-> 360
look_direction_u = np.sin(np.deg2rad(look_direction))
look_direction_v = np.cos(np.deg2rad(look_direction))
look_u_VRT = VRT(array=look_direction_u, lat=lat, lon=lon)
look_v_VRT = VRT(array=look_direction_v, lat=lat, lon=lon)
# Note: If incidence angle and look direction are stored in
# same VRT, access time is about twice as large
lookVRT = VRT(lat=lat, lon=lon)
lookVRT._create_band(
[{'SourceFilename': look_u_VRT.fileName, 'SourceBand': 1},
{'SourceFilename': look_v_VRT.fileName, 'SourceBand': 1}],
{'PixelFunctionType': 'UVToDirectionTo'})
# Blow up to full size
lookVRT = lookVRT.get_resized_vrt(gdalDataset.RasterXSize,
gdalDataset.RasterYSize)
# Store VRTs so that they are accessible later
self.bandVRTs['look_u_VRT'] = look_u_VRT
self.bandVRTs['look_v_VRT'] = look_v_VRT
self.bandVRTs['lookVRT'] = lookVRT
# Add band to full sized VRT
lookFileName = self.bandVRTs['lookVRT'].fileName
metaDict.append({'src': {'SourceFilename': lookFileName,
'SourceBand': 1},
'dst': {'wkv': 'sensor_azimuth_angle',
'name': 'look_direction'}})
###############################
# Create bands
###############################
self._create_bands(metaDict)
###################################################
# Add derived band (incidence angle) calculated
# using pixel function "BetaSigmaToIncidence":
###################################################
src = [{'SourceFilename': b0datasetName,
'SourceBand': b0datasetBand,
'DataType': dtype},
{'SourceFilename': s0datasetName,
'SourceBand': 1,
'DataType': dtype}]
dst = {'wkv': 'angle_of_incidence',
'PixelFunctionType': 'BetaSigmaToIncidence',
'SourceTransferType': gdal.GetDataTypeName(dtype),
'_FillValue': -10000, # NB: this is also hard-coded in
示例2: __init__
# 需要导入模块: from nansat.vrt import VRT [as 别名]
# 或者: from nansat.vrt.VRT import get_resized_vrt [as 别名]
#.........这里部分代码省略.........
pi = xml.node('generalAnnotation').node('productInformation')
self.dataset.SetMetadataItem('ORBIT_DIRECTION',
str(pi['pass']))
# Incidence angles are found in
#<geolocationGrid>
# <geolocationGridPointList count="#">
# <geolocationGridPoint>
geolocationGridPointList = (xml.node('geolocationGrid').
children[0])
X = []
Y = []
lon = []
lat = []
inc = []
ele = []
for gridPoint in geolocationGridPointList.children:
X.append(int(gridPoint['pixel']))
Y.append(int(gridPoint['line']))
lon.append(float(gridPoint['longitude']))
lat.append(float(gridPoint['latitude']))
inc.append(float(gridPoint['incidenceAngle']))
ele.append(float(gridPoint['elevationAngle']))
X = np.unique(X)
Y = np.unique(Y)
lon = np.array(lon).reshape(len(Y), len(X))
lat = np.array(lat).reshape(len(Y), len(X))
inc = np.array(inc).reshape(len(Y), len(X))
ele = np.array(ele).reshape(len(Y), len(X))
incVRT = VRT(array=inc, lat=lat, lon=lon)
eleVRT = VRT(array=ele, lat=lat, lon=lon)
incVRT = incVRT.get_resized_vrt(self.dataset.RasterXSize,
self.dataset.RasterYSize,
eResampleAlg=2)
eleVRT = eleVRT.get_resized_vrt(self.dataset.RasterXSize,
self.dataset.RasterYSize,
eResampleAlg=2)
self.bandVRTs['incVRT'] = incVRT
self.bandVRTs['eleVRT'] = eleVRT
for key in calDict.keys():
xml = self.read_xml(calDict[key])
calibration_LUT_VRTs, longitude, latitude = (
self.get_LUT_VRTs(xml,
'calibrationVectorList',
['sigmaNought', 'betaNought',
'gamma', 'dn']
))
self.bandVRTs['LUT_sigmaNought_VRT_'+pol[key]] = (
calibration_LUT_VRTs['sigmaNought'].
get_resized_vrt(self.dataset.RasterXSize,
self.dataset.RasterYSize,
eResampleAlg=1))
self.bandVRTs['LUT_betaNought_VRT_'+pol[key]] = (
calibration_LUT_VRTs['betaNought'].
get_resized_vrt(self.dataset.RasterXSize,
self.dataset.RasterYSize,
eResampleAlg=1))
self.bandVRTs['LUT_gamma_VRT'] = calibration_LUT_VRTs['gamma']
self.bandVRTs['LUT_dn_VRT'] = calibration_LUT_VRTs['dn']
for key in noiseDict.keys():
xml = self.read_xml(noiseDict[key])
noise_LUT_VRT = self.get_LUT_VRTs(xml, 'noiseVectorList',
['noiseLut'])[0]
self.bandVRTs['LUT_noise_VRT_'+pol[key]] = (
示例3: __init__
# 需要导入模块: from nansat.vrt import VRT [as 别名]
# 或者: from nansat.vrt.VRT import get_resized_vrt [as 别名]
#.........这里部分代码省略.........
'SourceTransferType': gdal.GetDataTypeName(dtype),
'dataType': intensityDataType}})
#####################################################################
# Add incidence angle and look direction through small VRT objects
#####################################################################
lon = self.get_array_from_ADS('first_line_longs')
lat = self.get_array_from_ADS('first_line_lats')
inc = self.get_array_from_ADS('first_line_incidence_angle')
# Calculate SAR look direction (ASAR is always right-looking)
look_direction = initial_bearing(lon[:, :-1], lat[:, :-1],
lon[:, 1:], lat[:, 1:])
# Interpolate to regain lost row
look_direction = scipy.ndimage.interpolation.zoom(
look_direction, (1, 11./10.))
# Decompose, to avoid interpolation errors around 0 <-> 360
look_direction_u = np.sin(np.deg2rad(look_direction))
look_direction_v = np.cos(np.deg2rad(look_direction))
look_u_VRT = VRT(array=look_direction_u, lat=lat, lon=lon)
look_v_VRT = VRT(array=look_direction_v, lat=lat, lon=lon)
# Note: If incidence angle and look direction are stored in
# same VRT, access time is about twice as large
incVRT = VRT(array=inc, lat=lat, lon=lon)
lookVRT = VRT(lat=lat, lon=lon)
lookVRT._create_band([{'SourceFilename': look_u_VRT.fileName,
'SourceBand': 1},
{'SourceFilename': look_v_VRT.fileName,
'SourceBand': 1}],
{'PixelFunctionType': 'UVToDirectionTo'})
# Blow up bands to full size
incVRT = incVRT.get_resized_vrt(gdalDataset.RasterXSize,
gdalDataset.RasterYSize)
lookVRT = lookVRT.get_resized_vrt(gdalDataset.RasterXSize,
gdalDataset.RasterYSize)
# Store VRTs so that they are accessible later
self.bandVRTs = {'incVRT': incVRT,
'look_u_VRT': look_u_VRT,
'look_v_VRT': look_v_VRT,
'lookVRT': lookVRT}
# Add band to full sized VRT
incFileName = self.bandVRTs['incVRT'].fileName
lookFileName = self.bandVRTs['lookVRT'].fileName
metaDict.append({'src': {'SourceFilename': incFileName,
'SourceBand': 1},
'dst': {'wkv': 'angle_of_incidence',
'name': 'incidence_angle'}})
metaDict.append({'src': {'SourceFilename': lookFileName,
'SourceBand': 1},
'dst': {'wkv': 'sensor_azimuth_angle',
'name': 'look_direction'}})
####################
# Add Sigma0-bands
####################
if gotCalibration:
for iPolarization in polarization:
# add dictionary for sigma0, ice and water
short_names = ['sigma0', 'sigma0_normalized_ice',
'sigma0_normalized_water']
wkt = [
'surface_backwards_scattering_coefficient_of_radar_wave',
'surface_backwards_scattering_coefficient_of_radar_wave_normalized_over_ice',