# Earth Engine Satellite Imagery Processing
This code file is designed to process satellite imagery using Google Earth Engine. It includes functions to acquire images from a specific date, process collections of images, and generate cloud maps. The code relies on several utility functions and external libraries.
## Dependencies
- Google Earth Engine (`ee`)
- Utility functions from `../utils`
- Metadata handling from `../../common/metadata`
- Cloud scoring from `../imagery`
## Constants
- `REVISIT_DAYS`: The number of days between satellite revisits (16 days).
## Functions
### `sliceByRevisit(collection, startingDate, days)`
Slices an image collection based on a starting date and a number of days.
- **Parameters:**
- `collection` (ee.ImageCollection): The image collection to slice.
- `startingDate` (String): The starting date for the slice.
- `days` (Number): The number of days to include in the slice.
- **Returns:**
- `ee.ImageCollection`: The sliced image collection.
### `acquireFromDate(date, collection, geometry)`
Acquires a mosaicked and clipped image from a specific date within a given geometry.
- **Parameters:**
- `date` (String): The date to acquire the image from.
- `collection` (String): The satellite image collection.
- `geometry` (ee.Geometry): The geometry to clip the image to.
- **Returns:**
- `ee.Image`: The processed image with cloud scoring applied.
### `processCollection(satellite, geometry)`
Processes a satellite image collection to compute valid dates for image acquisition.
- **Parameters:**
- `satellite` (String): The satellite name.
- `geometry` (ee.Geometry): The geometry to filter the collection by.
- **Returns:**
- `ee.List`: A list of valid dates for image acquisition.
### `generateCloudMap(dates, collection, geometry)`
Generates a cloud map for a list of dates within a given geometry.
- **Parameters:**
- `dates` (ee.List): A list of dates to generate the cloud map for.
- `collection` (String): The satellite image collection.
- `geometry` (ee.Geometry): The geometry to filter the collection by.
- **Returns:**
- `ee.List`: A list of cloud scores for each date.
## Usage Example
```javascript
import { acquireFromDate, processCollection, generateCloudMap } from './path/to/this/file';
// Define parameters
const satellite = 'Landsat';
const geometry = ee.Geometry.Point([longitude, latitude]);
const date = '2023-01-01';
// Acquire image from a specific date
const image = acquireFromDate(date, satellite, geometry);
// Process collection to get valid dates
const validDates = processCollection(satellite, geometry);
// Generate cloud map
const cloudMap = generateCloudMap(validDates, satellite, geometry);
Edge Cases and Assumptions
- Assumes that the input date is in a valid format.
- Assumes that the satellite collection contains images for the specified geometry.
- Handles cases where no images are found within a slice by setting empty properties.
References