本文整理汇总了Python中nansat.vrt.VRT._create_band方法的典型用法代码示例。如果您正苦于以下问题:Python VRT._create_band方法的具体用法?Python VRT._create_band怎么用?Python VRT._create_band使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nansat.vrt.VRT
的用法示例。
在下文中一共展示了VRT._create_band方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from nansat.vrt import VRT [as 别名]
# 或者: from nansat.vrt.VRT import _create_band [as 别名]
#.........这里部分代码省略.........
element of each column and minimum longitude at first element of each
row (e.g. np.shape(lat)=(59,55) -> latitude maxima are at lat[0,:],
and longitude minima are at lon[:,0])
In addition, there is an interpolation error for direct estimate along
azimuth. We therefore estimate the heading along range and add 90
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,
示例2: __init__
# 需要导入模块: from nansat.vrt import VRT [as 别名]
# 或者: from nansat.vrt.VRT import _create_band [as 别名]
#.........这里部分代码省略.........
self.dataset.RasterXSize,
self.dataset.RasterYSize,
eResampleAlg=1))
metaDict = []
bandNumberDict = {}
bnmax = 0
for key in gdalDatasets.keys():
dsPath, dsName = os.path.split(mdsDict[key])
name = 'DN_%s' % pol[key]
# A dictionary of band numbers is needed for the pixel function
# bands further down. This is not the best solution. It would be
# better to have a function in VRT that returns the number given a
# band name. This function exists in Nansat but could perhaps be
# moved to VRT? The existing nansat function could just call the
# VRT one...
bandNumberDict[name] = bnmax + 1
bnmax = bandNumberDict[name]
band = gdalDatasets[key].GetRasterBand(1)
dtype = band.DataType
metaDict.append({
'src': {
'SourceFilename': mdsDict[key],
'SourceBand': 1,
'DataType': dtype,
},
'dst': {
'name': name,
'SourceTransferType': gdal.GetDataTypeName(dtype),
'dataType': 6,
},
})
# add bands with metadata and corresponding values to the empty VRT
self._create_bands(metaDict)
'''
Calibration should be performed as
s0 = DN^2/sigmaNought^2,
where sigmaNought is from e.g.
annotation/calibration/calibration-s1a-iw-grd-hh-20140811t151231-20140811t151301-001894-001cc7-001.xml,
and DN is the Digital Numbers in the tiff files.
Also the noise should be subtracted.
See
https://sentinel.esa.int/web/sentinel/sentinel-1-sar-wiki/-/wiki/Sentinel%20One/Application+of+Radiometric+Calibration+LUT
'''
# Get look direction
sat_heading = initial_bearing(longitude[:-1, :],
latitude[:-1, :],
longitude[1:, :],
latitude[1:, :])
look_direction = scipy.ndimage.interpolation.zoom(
np.mod(sat_heading + 90, 360),
(np.shape(longitude)[0] / (np.shape(longitude)[0]-1.), 1))
# 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=latitude, lon=longitude)
look_v_VRT = VRT(array=look_direction_v,
lat=latitude, lon=longitude)
lookVRT = VRT(lat=latitude, lon=longitude)
示例3: __init__
# 需要导入模块: from nansat.vrt import VRT [as 别名]
# 或者: from nansat.vrt.VRT import _create_band [as 别名]
#.........这里部分代码省略.........
metaDict.append(
{'src': {'SourceFilename': fileName,
'SourceBand': iPolarization['bandNum'],
'DataType': dtype},
'dst': {'name': 'raw_counts_%s'
% iPolarization['channel'],
'PixelFunctionType': pixelFunctionType,
'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: