Skip to content

Commit

Permalink
Merge pull request #48 from ESA-PhiLab/develop
Browse files Browse the repository at this point in the history
merge latest developments
  • Loading branch information
BuddyVolly authored Sep 13, 2021
2 parents f9e629e + 091135b commit 73ee19c
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 24 deletions.
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM ubuntu:18.04

LABEL maintainer="Petr Sevcik, EOX"
LABEL OpenSARToolkit='0.10.1'
LABEL OpenSARToolkit='0.11.1'

# set work directory to home and download snap
WORKDIR /home/ost
Expand All @@ -10,8 +10,8 @@ WORKDIR /home/ost
COPY snap8.varfile $HOME

# update variables
ENV OTB_VERSION="7.1.0" \
TBX_VERSION="7" \
ENV OTB_VERSION="7.3.0" \
TBX_VERSION="8" \
TBX_SUBVERSION="0"
ENV TBX="esa-snap_sentinel_unix_${TBX_VERSION}_${TBX_SUBVERSION}.sh" \
SNAP_URL="http://step.esa.int/downloads/${TBX_VERSION}.${TBX_SUBVERSION}/installers" \
Expand Down
3 changes: 2 additions & 1 deletion ost/graphs/S1_SLC2ARD/S1_SLC_TNR_CalBeta_Deb_ML_TF_Sub.xml
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,10 @@
<demResamplingMethod>${dem_resampling}</demResamplingMethod>
<externalDEMFile>${dem_file}</externalDEMFile>
<externalDEMNoDataValue>${dem_nodata}</externalDEMNoDataValue>
<externalDEMApplyEGM>${egm_correction}</externalDEMApplyEGM>
<outputSimulatedImage>false</outputSimulatedImage>
<additionalOverlap>0.15</additionalOverlap>
<oversamplingMultiple>1.5</oversamplingMultiple>
<outputSimulatedImage>false</outputSimulatedImage>
</parameters>
</node>
<node id="Subset">
Expand Down
2 changes: 1 addition & 1 deletion ost/s1/burst_to_ard.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ def create_coherence_layers(

# run co-registration
try:
slc.coreg2(
slc.coreg(
master_import, slave_import, out_coreg, coreg_log, config_dict
)
except (GPTRuntimeError, NotValidFileError) as error:
Expand Down
43 changes: 27 additions & 16 deletions ost/s1/refine_inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ def _remove_double_entries(inventory_df):
)['ingestiondate'].transform(max) == inventory_df['ingestiondate']

# re-initialize GDF geometry due to groupby function
crs = fiona.crs.from_epsg(4326)
gdf = gpd.GeoDataFrame(inventory_df[idx], geometry='geometry', crs=crs)
gdf = gpd.GeoDataFrame(
inventory_df[idx], geometry='geometry', crs='epsg:4326'
)

logger.info(
f'{len(inventory_df[idx])} frames remain after double entry removal'
)
Expand Down Expand Up @@ -91,7 +93,7 @@ def _handle_equator_crossing(inventory_df):
crossing the equator the relative orbit will increase by 1.
This routine checks for the appearance of such kind and unifies the
relativeorbitnumbers so that the inventory is complinat with the
relativeorbit numbers so that the inventory is compliant with the
subsequent batch processing routines of OST
Args:
Expand Down Expand Up @@ -247,7 +249,8 @@ def _remove_incomplete_tracks(aoi_gdf, inventory_df):
out_frame = out_frame.append(gdf_date)

logger.info(
f'{len(out_frame)} frames remain after removal of non-full AOI crossing'
f' {len(out_frame)} frames remain after'
f' removal of non-full AOI crossing'
)
return out_frame

Expand Down Expand Up @@ -279,9 +282,10 @@ def _handle_non_continous_swath(inventory_df):

for date in dates:

subdf = inventory_df[(inventory_df['acquisitiondate'] == date) &
(inventory_df['relativeorbit'] == track)
].sort_values('slicenumber')
subdf = inventory_df[
(inventory_df['acquisitiondate'] == date) &
(inventory_df['relativeorbit'] == track)
].sort_values('slicenumber')

if (len(subdf) <= int(subdf.slicenumber.max()) -
int(subdf.slicenumber.min())):
Expand Down Expand Up @@ -320,8 +324,9 @@ def _forward_search(aoi_gdf, inventory_df, area_reduce=0):
out_frame = gpd.GeoDataFrame(columns=inventory_df.columns)

# loop through dates
for date in sorted(inventory_df['acquisitiondate'].unique(),
reverse=False):
for date in sorted(
inventory_df['acquisitiondate'].unique(), reverse=False
):

# set starting date for curent mosaic
if start_date is None:
Expand Down Expand Up @@ -391,8 +396,10 @@ def _backward_search(aoi_gdf, inventory_df, datelist, area_reduce=0):
for dates in datelist:

# extract scenes for single mosaics
gdf = inventory_df[(inventory_df['acquisitiondate'] <= dates[1]) &
(inventory_df['acquisitiondate'] >= dates[0])]
gdf = inventory_df[
(inventory_df['acquisitiondate'] <= dates[1]) &
(inventory_df['acquisitiondate'] >= dates[0])
]

# we create an emtpy list and fill with tracks used for the mosaic,
# so they are not used twice
Expand All @@ -413,12 +420,15 @@ def _backward_search(aoi_gdf, inventory_df, datelist, area_reduce=0):
included_tracks.append(track)

# get all footprints for each date and track
track_gdf = gdf[(gdf['acquisitiondate'] == date) &
(gdf['relativeorbit'] == track)]
track_gdf = gdf[
(gdf['acquisitiondate'] == date) &
(gdf['relativeorbit'] == track)
]

# re-initialize GDF due to groupby fucntion
track_gdf = gpd.GeoDataFrame(track_gdf,
geometry='geometry')
track_gdf = gpd.GeoDataFrame(
track_gdf, geometry='geometry'
)

# get a unified geometry for date/track combination
union = track_gdf.geometry.unary_union
Expand Down Expand Up @@ -520,7 +530,8 @@ def search_refinement(
(inventory_df['orbitdirection'] == orb)]

logger.info('{} frames for {} tracks in {} polarisation.'.format(
len(inv_df_sorted), orb, pol))
len(inv_df_sorted), orb, pol)
)

# calculate intersected area
inter = aoi_gdf.geometry.intersection(inv_df_sorted.unary_union)
Expand Down
6 changes: 3 additions & 3 deletions ost/s1/slc_wrappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@ def calibration(
:param outfile:
:param logfile:
:param config_dict:
:param region:
:return:
"""

Expand All @@ -198,9 +197,10 @@ def calibration(
cpus = config_dict['snap_cpu_parallelism']
dem_dict = ard['dem']
region = ''

# calculate Multi-Look factors
azimuth_looks = 1 # int(np.floor(ard['resolution'] / 10 ))
range_looks = 5 # int(azimuth_looks * 5)
range_looks = 6 # int(azimuth_looks * 5)

# construct command dependent on selected product type
if ard['product_type'] == 'RTC-gamma0':
Expand All @@ -220,6 +220,7 @@ def calibration(
f"-Pdem_file=\'{dem_dict['dem_file']}\' "
f"-Pdem_nodata={dem_dict['dem_nodata']} "
f"-Pdem_resampling={dem_dict['dem_resampling']} "
f"-Pegm_correction={dem_dict['egm_correction']} "
f"-Pregion=\'{region}\' "
f"-Pinput={str(infile)} "
f"-Poutput={str(outfile)}"
Expand Down Expand Up @@ -311,7 +312,6 @@ def coreg(master, slave, outfile, logfile, config_dict):
command = (
f'{GPT_FILE} Back-Geocoding -x -q {2*cpus} '
f'-PdemName=\'{dem_dict["dem_name"]}\' '
#f'-PdemName=\'SRTM 3Sec\' '
f'-PdemResamplingMethod=\'{dem_dict["dem_resampling"]}\' '
f'-PexternalDEMFile=\'{dem_dict["dem_file"]}\' '
f'-PexternalDEMNoDataValue=\'{dem_dict["dem_nodata"]}\' '
Expand Down

0 comments on commit 73ee19c

Please sign in to comment.