Skip to content

Commit

Permalink
Update SDS_preprocess.py
Browse files Browse the repository at this point in the history
- fix loading of reference shoreline when multiple shorelines are digitised
- remove buffered cloud mask from Landsat (bit 1)
  • Loading branch information
kvos committed Nov 22, 2024
1 parent 2df054c commit cdbf9a4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions coastsat/SDS_preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ def is_set(x, n):
qa_values = np.unique(im_QA.flatten())
cloud_values = []
for qaval in qa_values:
for k in [1,2,3]: # check the first 3 flags
for k in [2,3]: # check the first 3 flags
if is_set(qaval,k):
cloud_values.append(qaval)

Expand Down Expand Up @@ -780,7 +780,10 @@ def get_reference_sl(metadata, settings):
if os.path.exists(fp_ref_shoreline):
print('Reference shoreline already exists and was loaded')
refsl_geojson = gpd.read_file(fp_ref_shoreline,driver='GeoJSON')
refsl = np.array(refsl_geojson.iloc[0]['geometry'].coords)
shoreline_points = []
for k in range(len(refsl_geojson)):
shoreline_points += list(refsl_geojson.iloc[k]['geometry'].coords)
refsl = np.array(shoreline_points)
print('Reference shoreline coordinates are in epsg:%d'%refsl_geojson.crs.to_epsg())
return refsl

Expand Down

0 comments on commit cdbf9a4

Please sign in to comment.