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

CryoTEMPO SI.9/PO.9 - Implement a more accurate land-ocean mask #70

Closed
1 of 2 tasks
shendric opened this issue Apr 22, 2022 · 10 comments
Closed
1 of 2 tasks

CryoTEMPO SI.9/PO.9 - Implement a more accurate land-ocean mask #70

shendric opened this issue Apr 22, 2022 · 10 comments
Assignees
Labels
ongoing long-term tasks question Further information is requested

Comments

@shendric
Copy link
Collaborator

shendric commented Apr 22, 2022

The current land/ocean mask is based on GSHGG data, which is incorrect. The task includes the following actions:

  • Identify a suitable land/ocean mask
  • Implement replacement of surface type flag in l1 pre-processor
@shendric shendric added this to the CryoTEMPO Cycle 2.1 TDS milestone Apr 22, 2022
@shendric shendric added question Further information is requested CryoTEMPO labels Apr 25, 2022
@shendric
Copy link
Collaborator Author

Which landmask and type (grid/shapefile) should we use?

@shendric shendric self-assigned this Apr 25, 2022
@shendric
Copy link
Collaborator Author

This issue also requires the change of the Level-1 pre-processor:

At the moment there is no injection point of auxiliary information, before the extraction of polar ocean segments. This method already relies on the existing land/ocean flag in the l1 source data and thus an injection point for data must be established directly after the source file is parsed.

This will also be beneficial if data should be added to the l1p data object that exists for the same period as the source data.

@shendric
Copy link
Collaborator Author

Three available land and or ocean shapefile products have been downloaded:

  1. Global Self-consistent, Hierarchical, High-resolution Geography Database (GSHHG) v2.3.7
  2. Natural Earth (NE) 1:10 million coastline
  3. Open Street Map (OSM) Land Polygons

The resolution of the GSHHG (at full resolution) and OSM exceed the NE coastline. However a critical test is the coast line of greenland and all coastlines were evaluated against Global 30 Arc-Second Elevation (GTOPO30) digital elevation model:

greenland-test

The result was that the Natural Earth land mask hat the best agreement with the topographic data. But since Natural Earth lacks detail (small islands) in other parts of the Arctic Ocean, the goal for the moment is to create a land/ocean mask based on OSM, except for Greenland, which is based on NE.

@shendric
Copy link
Collaborator Author

As a first step, Greenland is manually removed from the OSM shapefile with QGIS. The remaining shapes are then rasterized using gdal on a 0.005 x 0.005 degree global grid (approximately 100m at 80N):

gdal_rasterize -l land_polygons -burn 255 -ot Byte -of gtiff -tr 0.005 0.005 land_polygons.shp land_polygons_raster_osm_wgs84.tiff

land_polygons_raster_osm_wgs84

The chosen resolution preserved small islands (example here is Hinlopenstretet in Svalbard):

land_polygons_raster_osm_wgs84_closeup_svalbard

@shendric
Copy link
Collaborator Author

The total filesize of the global geotiff (date type Byte) is 2.4GB, which is excessive to hold in memory during the Level-1 pre-processor. The global data is therefore reprojecedt to a polar projection (WGS 84 / NSIDC EASE-Grid 2.0 North, EPSG:6931) again using gdal:

gdalwarp -s_srs WGS84 -t_srs EPSG:6931 -tr 250 250 -te -5000000 -5000000 5000000 5000000 -multi -r near -ot Byte -overwrite land_polygons_raster_osm_wgs84.tiff land_polygons_raster_osm_epsg6931.tiff

The output is a 1.2GB geoTIFF file with 40000P x 40000L pixels, which includes the full CryoSat-2 subset (north of 45N) used for CryoTEMPO:

land_polygons_raster_osm_epsg6931

@shendric
Copy link
Collaborator Author

Workflow to merge the Natural Earth Greenland polygon into the Open Street Map shapefile:

  1. Select and remove the Greenland layer from the OSM shapefile using QGIS
  2. Select Greenland layer from NE shapefile and remove all other shapes using QGIS (Note: In the NE land shapefile all land is one layer and Greenland itself cannot be easily selected. That is possible for the coastlines though and after selecting only Greenland the line object is converted into a polygon)
  3. Import the NE Greenland polygon to the edited OSM shapefile
  4. Merge the layers and save as new shape file.
  5. Repeats rasterize and reprojection steps from above

The result:

land_polygons_raster_osm_epsg6931_cryotempo

@shendric shendric added the ongoing long-term tasks label May 10, 2022
@shendric
Copy link
Collaborator Author

shendric commented May 10, 2022

Gdal also offers a way to compute the distance to the coast with gdal_proximity.py. This might be useful addition for filtering in later evolutions.

gdal_proximity.py land_polygons_raster_osm_epsg6931.tiff distance_to_coast_raster_osm_epsg6931.tiff -ot Float32 -values 255 -distunits GEO

The result for full mask extent:

cryotempo-distance_to_coast_01

and a subset at full resolution in the Canadian Archipelago:

cryotempo-distance_to_coast_02

@shendric
Copy link
Collaborator Author

Updated the Level-1 pre-processor workflow in shendric@d488118. It is now possible to the specify a stage for a L1 pre-processor item to run:

Possible pre-processor stages:

  1. post_source_file
  2. post_ocean_segment_extraction
  3. post_merge

The change was necessary, because the updated land/ocean flag needs to be swapped in before the ocean segment extraction. And before were called only after the ocean segment extraction.

@shendric
Copy link
Collaborator Author

shendric commented Jun 2, 2022

Running first tests in the Level-1 Pre-Processor:

  • Memory footprint is a few < 5 GB.
  • Extraction of both variables per source file is approximately 0.005 seconds
  • Minor differences to ESA land/ocean flag observed, with potential improvements in one test case:

initial-test-stack-peakiness

Next step is larger test.

@shendric
Copy link
Collaborator Author

Feature is on operation. This issue will be closed for now, but may be re-opened for land/ocean mask udpates

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ongoing long-term tasks question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant