Skip to content

Commit

Permalink
extend transects and rerun
Browse files Browse the repository at this point in the history
  • Loading branch information
neon-ninja committed Aug 22, 2024
1 parent b69b671 commit 79e7edb
Show file tree
Hide file tree
Showing 1,406 changed files with 640,263 additions and 495,043 deletions.
32 changes: 17 additions & 15 deletions batch_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,29 +37,29 @@
shorelines.set_index("id", inplace=True)

# Transects, origin is landward
transects_gdf = gpd.read_file("transects.geojson").to_crs(CRS).drop_duplicates(subset="id")
transects_gdf = gpd.read_file("transects_extended.geojson").to_crs(CRS).drop_duplicates(subset="id")
transects_gdf.set_index("id", inplace=True)

print(f"{time.time() - start}: Reference polygons and shorelines loaded")

def process_site(sitename):
print(f"Now processing {sitename}")

df = pd.read_csv(f"data/{sitename}/transect_time_series.csv")
df.set_index("Unnamed: 0", inplace=True)
df.dates = pd.to_datetime(df.dates)
#df = pd.read_csv(f"data/{sitename}/transect_time_series.csv")
#df.set_index("Unnamed: 0", inplace=True)
#df.dates = pd.to_datetime(df.dates)

inputs = {
"polygon": list(poly.geometry[sitename].exterior.coords),
"dates": [str(df.dates.max().date() + timedelta(days=1)), '2030-12-30'], # All available imagery
"dates": ["1900-01-01", '2030-12-30'], # All available imagery
"sat_list": ['L5','L7','L8','L9'],
"sitename": sitename,
"filepath": 'data',
"landsat_collection": 'C02',
}
#result = SDS_download.check_images_available(inputs)
metadata = SDS_download.retrieve_images(inputs)
#metadata = SDS_download.get_metadata(inputs)
#metadata = SDS_download.retrieve_images(inputs)
metadata = SDS_download.get_metadata(inputs)

# settings for the shoreline extraction
settings = {
Expand Down Expand Up @@ -92,7 +92,7 @@ def process_site(sitename):

ref_sl = np.array(line_merge(split(shorelines.geometry[sitename], transects_at_site.unary_union)).coords)

settings["max_dist_ref"] = 100
settings["max_dist_ref"] = 300
settings["reference_shoreline"] = np.flip(ref_sl)

output = SDS_shoreline.extract_shorelines(metadata, settings)
Expand Down Expand Up @@ -120,17 +120,19 @@ def process_site(sitename):
# save a .csv file for Excel users
out_dict = dict([])
out_dict['dates'] = output['dates']
out_dict["satname"] = output["satname"]
for key in transects.keys():
out_dict[key] = cross_distance[key]

new_results = pd.DataFrame(out_dict)
if len(new_results) == 0:
return
df = pd.concat([df, new_results], ignore_index=True)
df.sort_values("dates", inplace=True)

#new_results = pd.DataFrame(out_dict)
#if len(new_results) == 0:
# return
#df = pd.concat([df, new_results], ignore_index=True)
#df.sort_values("dates", inplace=True)
df = pd.DataFrame(out_dict)
fn = os.path.join(settings['inputs']['filepath'],settings['inputs']['sitename'],
'transect_time_series.csv')
df.to_csv(fn, sep=',')
df.to_csv(fn, index=False, float_format='%.2f')
print(f'{sitename} is done! Time-series of the shoreline change along the transects saved as:{fn}')

process_map(process_site, poly.index, max_workers=32)
358 changes: 179 additions & 179 deletions data/nzd0001/transect_time_series.csv

Large diffs are not rendered by default.

358 changes: 179 additions & 179 deletions data/nzd0001/transect_time_series_tidally_corrected.csv

Large diffs are not rendered by default.

358 changes: 179 additions & 179 deletions data/nzd0002/transect_time_series.csv

Large diffs are not rendered by default.

358 changes: 179 additions & 179 deletions data/nzd0002/transect_time_series_tidally_corrected.csv

Large diffs are not rendered by default.

340 changes: 170 additions & 170 deletions data/nzd0003/transect_time_series.csv

Large diffs are not rendered by default.

340 changes: 170 additions & 170 deletions data/nzd0003/transect_time_series_tidally_corrected.csv

Large diffs are not rendered by default.

266 changes: 133 additions & 133 deletions data/nzd0004/transect_time_series.csv

Large diffs are not rendered by default.

266 changes: 133 additions & 133 deletions data/nzd0004/transect_time_series_tidally_corrected.csv

Large diffs are not rendered by default.

400 changes: 200 additions & 200 deletions data/nzd0005/transect_time_series.csv

Large diffs are not rendered by default.

400 changes: 200 additions & 200 deletions data/nzd0005/transect_time_series_tidally_corrected.csv

Large diffs are not rendered by default.

392 changes: 196 additions & 196 deletions data/nzd0006/transect_time_series.csv

Large diffs are not rendered by default.

392 changes: 196 additions & 196 deletions data/nzd0006/transect_time_series_tidally_corrected.csv

Large diffs are not rendered by default.

200 changes: 100 additions & 100 deletions data/nzd0007/transect_time_series.csv

Large diffs are not rendered by default.

200 changes: 100 additions & 100 deletions data/nzd0007/transect_time_series_tidally_corrected.csv

Large diffs are not rendered by default.

412 changes: 206 additions & 206 deletions data/nzd0008/transect_time_series.csv

Large diffs are not rendered by default.

412 changes: 206 additions & 206 deletions data/nzd0008/transect_time_series_tidally_corrected.csv

Large diffs are not rendered by default.

256 changes: 128 additions & 128 deletions data/nzd0009/transect_time_series.csv

Large diffs are not rendered by default.

256 changes: 128 additions & 128 deletions data/nzd0009/transect_time_series_tidally_corrected.csv

Large diffs are not rendered by default.

208 changes: 104 additions & 104 deletions data/nzd0010/transect_time_series.csv

Large diffs are not rendered by default.

208 changes: 104 additions & 104 deletions data/nzd0010/transect_time_series_tidally_corrected.csv

Large diffs are not rendered by default.

344 changes: 172 additions & 172 deletions data/nzd0011/transect_time_series.csv

Large diffs are not rendered by default.

344 changes: 172 additions & 172 deletions data/nzd0011/transect_time_series_tidally_corrected.csv

Large diffs are not rendered by default.

382 changes: 191 additions & 191 deletions data/nzd0012/transect_time_series.csv

Large diffs are not rendered by default.

382 changes: 191 additions & 191 deletions data/nzd0012/transect_time_series_tidally_corrected.csv

Large diffs are not rendered by default.

Loading

0 comments on commit 79e7edb

Please sign in to comment.