Major-TOM icon indicating copy to clipboard operation
Major-TOM copied to clipboard

Expand grid functionality and add demo notebook

Open uceshaf opened this issue 1 year ago • 0 comments

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.

uceshaf avatar Jan 07 '25 23:01 uceshaf