Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expand grid functionality and add demo notebook #16

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

uceshaf
Copy link

@uceshaf uceshaf commented Jan 7, 2025

Made Changes to grid.py file, setup.py and added a notebook grid_functionality_demo.ipynb in /extras

Problem: The grid generation process in grid.py generates points but the footprints or grid polygons generated do not fully align with the raster outlines.
image

Therefore, functionality to create the Major-TOM raster tiles exact outlines for facilitating new dataset creations and computations has been added.

Below is a detailed comparison and documentation of the changes introduced in grid.py compared to old grid.py.

1. New Features and Functions Added

  1. get_product_outline_for_cell: Purpose: Create the exact outline of the tile corresponding to a grid_cell which will match the downloaded tile form Major-TOM
  2. generate_product_outlines_for_utm_zone: Purpose: Generates product outlines for a given UTM zone, with optional inclusion of utm_footprint and file export.
  3. generate_global_product_outlines_by_utm: Purpose: Generates global product outlines grouped by UTM zones. The output folder will have 120 files corresponding to each UTM zone
  4. generate_product_outlines: Purpose: Computes product outlines for a GeoDataFrame of grid points (for a UTM zone) in a vectorized way. Also, allows to create the utm_footprint column containing shapely polygons
  5. ensure_file_extension: Purpose: Ensures the correct file extension based on the specified selected driver.
  6. merge_utm_files_to_wgs84: Purpose: Merges multiple UTM zone-specific files into a single WGS84 file. Useful to create a single global product outline file

2. Changes to Existing Functions

  1. get_points: Changed column names:
     From name to grid_cell.
     From epsg to utm_crs.
     Ensures the naming matches the columns already in the metadata parquet files

3. Some Tests Added in the Main Section
o Tested for New Functions
o generate_product_outlines_for_utm_zone: Verified with a UTM zone.
o generate_global_product_outlines_by_utm: Checked output folder creation and file generation.
o merge_utm_files_to_wgs84: Ensured correct merging and projection into WGS84.

4. grid_functionality_demo.ipynb:
o The notebook demonstrates the usage of the function and running the notebook generates the product outlines for the default S2 parameters which can be modified.

5. Setup.py:
o Added missing dependencies torchgeo and open_clip_torch to setup.py, which caused import errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant