Code Overview
This code is designed to interact with Google Earth Engine (GEE) to process satellite imagery data. It includes functions to filter and process image collections based on specific criteria, such as date and geographic bounds, and to generate cloud cover maps.
Dependencies
- Google Earth Engine (GEE) library
- Utility functions from
../utils
- Metadata constants from
../../common/metadata
- Cloud scoring function from
../imagery
Functions
addGridPosition(element)
Adds a grid position to an image based on its WRS path and row.
-
Parameters:
-
element
: An image element from GEE.
-
-
Returns:
- An image with an added grid position property.
sliceByRevisit(collection, startingDate, days)
Slices an image collection based on a starting date and a number of days.
-
Parameters:
-
collection
: GEE ImageCollection to be sliced. -
startingDate
: The starting date for the slice. -
days
: Number of days to include in the slice.
-
-
Returns:
- A filtered image collection.
acquireFromDate(date, mission, geometry)
Acquires a mosaic image from a specific date, mission, and geometry, and scores it for cloud cover.
-
Parameters:
-
date
: The date for which to acquire the image. -
mission
: The satellite mission (e.g., Landsat). -
geometry
: The geographic bounds for the image.
-
-
Returns:
- A cloud-scored image.
processCollection(mission, geometry)
Processes an image collection to compute valid dates for image acquisition.
-
Parameters:
-
mission
: The satellite mission. -
geometry
: The geographic bounds for the image collection.
-
-
Returns:
- A list of valid dates.
generateCloudMap(dates, mission, geometry)
Generates a cloud cover map for a list of dates.
-
Parameters:
-
dates
: A list of dates. -
mission
: The satellite mission. -
geometry
: The geographic bounds for the images.
-
-
Returns:
- A list of cloud cover percentages.
queryAvailable(mission)
Queries available images for a given mission and geometry.
-
Parameters:
-
mission
: The satellite mission.
-
-
Returns:
- A function that takes
geometry
as a parameter and returns a dictionary of dates and cloud cover percentages.
- A function that takes
getAvailable(mission)
Placeholder function for getting available images.
-
Parameters:
-
mission
: The satellite mission.
-
-
Returns:
- A function that takes
geometry
as a parameter.
- A function that takes
acquire(mission)
Acquires an image for a given mission, date, and geometry.
-
Parameters:
-
mission
: The satellite mission. -
date
: The date for which to acquire the image. -
geometry
: The geographic bounds for the image.
-
-
Returns:
- The acquired image.
format(properties)
Formats image properties into a string.
-
Parameters:
-
properties
: The properties of the image.
-
-
Returns:
- A formatted string.
Usage Examples
Acquiring an Image
const mission = { name: 'LANDSAT/LC08/C01/T1_SR', cycle: 16, bands: { qa: 'BQA' } };
const date = '2021-01-01';
const geometry = ee.Geometry.Point([102.0, 17.0]);
const image = acquireFromDate(date, mission, geometry);
Generating a Cloud Map
const dates = ['2021-01-01', '2021-01-17'];
const cloudMap = generateCloudMap(dates, mission, geometry);
Querying Available Images
const availableImages = queryAvailable(mission)(geometry);
Edge Cases and Assumptions
- Assumes that input dates are in a valid format.
- Assumes that the geometry provided is valid and within the bounds of the satellite mission.
- Handles cases where no images are available by returning empty lists or dictionaries.
References
- Google Earth Engine Documentation
- Utility functions and metadata constants are imported from local modules.