How to remove specific coastlines in the output.pkl file? #564
-
Is it possible to remove specific coastlines by date in the output.pkl file? By analyzing the selected coastlines in the GIS software with the GeoJson file generated from the output.pkl file, I identified 3 coastlines out of a set of 807 that I wanted to remove from the previous selection. In the GIS it was easy to identify the date of the coastlines to be removed, delete them and save the new GeoJson without the unwanted coastlines. However, to continue the analysis in the CoastSat notebook with the .pkl file, I was unable to remove the unwanted coastlines that I removed in the GeoJson. In fact, I even generated a script using the pickle library, which supposedly removed the unwanted coastlines from the output.pkl file, but I was unable to continue with the analyses on the CoastSat notebook because the metadata stored in the output variable was probably different from the modified .pkl file, resulting in several errors in the code. Thus, I really would like a more practical solution to continue the analyses without having to manually select over 800 coastlines again, adjusting thresholds, etc, to build my database, taking care not to accidentally select these 3 unwanted coastlines. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Beta Was this translation helpful? Give feedback.
I think I got it here.
The problem was with how I was calling the adjusted .pkl file in the coastsat notebook, after running the routine I made to filter the coastlines.
So, here is the code to filter coastlines from the .pkl file, selected by mistake in the previous step, from specific dates and satellite missions.
##################################################################
Step 01 - Load Python Libraries
import sys
sys.path.append("C:/your/path/to/coastsat")
import pickle
from datetime import datetime
Step 02 - Load the coastsat .pkl original file
file_path = "C:/your/path/to/coastsat/case/filename_output.pkl"
with open(file_path, 'rb') as file:
coastsat_data = pickle.load(file)
S…