Merge pull request #54 from gshiroma/master

Updates the sensor: UAVSAR_HDF5_SLC
LT1AB
piyushrpt 2019-07-30 11:15:55 -07:00 committed by GitHub
commit a219942280
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 5 deletions

View File

@ -188,7 +188,10 @@ class UAVSAR_HDF5_SLC(Sensor):
referenceUTC = file['/science/LSAR/SLC/swaths/zeroDopplerTime'].attrs['units'].decode('utf-8')
referenceUTC = referenceUTC.replace('seconds since ','')
referenceUTC = datetime.datetime.strptime(referenceUTC,'%Y-%m-%d %H:%M:%S')
format_str = '%Y-%m-%d %H:%M:%S'
if '.' in referenceUTC:
format_str += '.%f'
referenceUTC = datetime.datetime.strptime(referenceUTC, format_str)
relStart = file['/science/LSAR/SLC/swaths/zeroDopplerTime'][0]
relEnd = file['/science/LSAR/SLC/swaths/zeroDopplerTime'][-1]
@ -222,7 +225,10 @@ class UAVSAR_HDF5_SLC(Sensor):
referenceUTC = file['/science/LSAR/SLC/swaths/zeroDopplerTime'].attrs['units'].decode('utf-8')
referenceUTC = referenceUTC.replace('seconds since ','')
t0 = datetime.datetime.strptime(referenceUTC,'%Y-%m-%d %H:%M:%S')
format_str = '%Y-%m-%d %H:%M:%S'
if '.' in referenceUTC:
format_str += '.%f'
t0 = datetime.datetime.strptime(referenceUTC, format_str)
t = file['/science/LSAR/SLC/metadata/orbit/time']
position = file['/science/LSAR/SLC/metadata/orbit/position']
velocity = file['/science/LSAR/SLC/metadata/orbit/velocity']
@ -247,9 +253,11 @@ class UAVSAR_HDF5_SLC(Sensor):
ds = fid['/science/LSAR/SLC/swaths/' + self.frequency + '/' + self.polarization]
nLines = ds.shape[0]
with open(self.output, 'wb') as fout:
for ii in range(nLines):
ds[ii,:].astype(np.complex64).tofile(fout)
# force casting to complex64
with ds.astype(np.complex64):
with open(self.output, 'wb') as fout:
for ii in range(nLines):
ds[ii, :].tofile(fout)
fid.close()