diff --git a/README.md b/README.md index 23a9c4d..78e49e4 100644 --- a/README.md +++ b/README.md @@ -28,13 +28,15 @@ Before installing this project, ensure you have the following requirements: ### Clone the Repository -Clone the project using the `dev` branch (this branch contains the latest development features): +Clone the project using the default `master` branch: ```bash -git clone -b dev https://github.com/your-username/coastline-extraction.git -cd coastline-extraction +git clone https://github.com/fwitmer/CoastlineExtraction.git +cd CoastlineExtraction ``` +> ⚠️ Note: The repository currently contains only the `master` branch. Earlier versions of this README referenced a non-existent `dev` branch and an incorrect repository URL (`coastlineExtraction.git`), which caused cloning to fail for new users. + --- ### Environment Setup @@ -124,20 +126,22 @@ shapefile_path = get_shapefile_path(config, 0) # First shapefile ## Contributing -### Working with the Dev Branch +### Contribution Workflow + +This project currently uses the `master` branch as the primary development branch. -This project uses the `dev` branch for active development. When contributing: +When contributing: 1. **Fork the repository on GitHub** -2. **Clone your fork using the `dev` branch**: +2. **Clone your fork**: ```bash -git clone -b dev https://github.com/your-username/coastline-extraction.git -cd coastline-extraction +git clone https://github.com/your-username/CoastlineExtraction.git +cd CoastlineExtraction ``` -3. **Create a feature branch from `dev`**: +3. **Create a feature branch from `master`**: ```bash git checkout -b feature/your-feature-name diff --git a/data_preprocessing/create_masks.py b/data_preprocessing/create_masks.py index 8c019e3..5494c4c 100644 --- a/data_preprocessing/create_masks.py +++ b/data_preprocessing/create_masks.py @@ -1,13 +1,16 @@ # import libraries import rasterio as rio -from rasterio import mask -from rasterio.plot import show from rasterio.mask import mask +from rasterio.plot import show from rasterio.io import MemoryFile + import shapely -from shapely.geometry import Polygon, shape, box # added box +from shapely.geometry import Polygon, shape, box import geopandas as gpd + +import sys import os + from matplotlib import pyplot as plt import numpy as np import cv2 @@ -78,8 +81,8 @@ def get_ndwi_label(image_path, points_path, ksize=100, blurring=True, out_dir="r np.seterr(divide='ignore', invalid='ignore') - ndwi = (green - nir) / (green + nir) # NDWI equation - ndwi[np.isnan(ndwi)] = 0 # Sets any NaN values in the NDWI array to 0. (Dividing by zero => NaN pixels) + ndwi = (green - nir) / (green + nir + 1e-8) # NDWI equation + # ndwi[np.isnan(ndwi)] = 0 # Sets any NaN values in the NDWI array to 0. (Dividing by zero => NaN pixels) ndwi_profile = src_raster.profile # Copies the image profile (metadata). # Apply Gaussian blur @@ -152,7 +155,7 @@ def get_ndwi_label(image_path, points_path, ksize=100, blurring=True, out_dir="r if buffer.intersects(raster_bounds_geom): out_image, out_transform = mask(dataset, shapes=[buffer], nodata=-1, crop=False) out_image = out_image[0] - out_image = (out_image * 127) + 128 + out_image = ((out_image + 1) * 127.5).astype(np.uint8) out_image = out_image.astype(np.uint8) out_image_clipped, out_transform_clipped = mask(dataset, shapes=[buffer], nodata=-1, crop=True)