Module: sentinel.js
sentinel.js
Comprehensive Analysis of Module Name
-
Module Name:
sentinel.js
Primary Objectives
- Purpose: This module is designed to interact with satellite imagery data, specifically Sentinel and Landsat missions, to process and filter images based on cloud coverage and other criteria. It provides functionalities to acquire images from specific dates, process collections of images, and generate cloud maps.
Critical Functions
- addGridPosition(element): Adds grid position metadata to an image.
- sliceByRevisit(collection, startingDate, days): Filters a collection of images by a date range.
- getImageDate(image): Extracts the date from an image's ID.
- maskS2Clouds(img, geometry, bandName, scale, imgDateParam): Masks clouds in Sentinel-2 images and calculates the cloud coverage ratio.
- acquireFromDate(date, mission, geometry): Acquires an image from a specific date and mission, applying cloud masking.
- processCollection(mission, geometry): Processes a collection of images to find valid dates for image acquisition.
- generateCloudMap(dates, mission, geometry): Generates a list of cloud coverage values for a series of dates.
- queryAvailable(mission): Returns a function that queries available images for a mission and geometry.
-
getAvailable(mission): Similar to
queryAvailable
, but returns the results directly. - acquire(mission): Returns a function to acquire an image for a specific date and geometry.
- format(properties): Formats image properties for display.
Key Variables
- Metadata.GRID_POSITION: Metadata key for grid position.
- bandName: Name of the band used for cloud masking.
- scale: Scale used for cloud masking.
- geometry: Geometric area of interest.
- mission: Object containing mission details like name and cycle.
Interdependencies
-
External Services:
-
ee
from../../services/earth-engine
: Earth Engine API for image processing.
-
-
Utility Functions:
-
mergeProperties
,retrieveExtremes
,getDate
from../utils
.
-
-
Algorithms:
-
acquireFromDateLandSat
from../../algorithms/satellite/landsat
.
-
-
Common Metadata:
-
Metadata
from../../common/metadata
.
-
Core vs. Auxiliary Operations
-
Core Operations:
acquireFromDate
processCollection
generateCloudMap
maskS2Clouds
-
Auxiliary Operations:
addGridPosition
sliceByRevisit
getImageDate
queryAvailable
getAvailable
acquire
format
Operational Sequence
-
Image Acquisition:
acquireFromDate
is used to acquire images from a specific date and mission. -
Cloud Masking:
maskS2Clouds
is applied to filter out cloud-covered areas. -
Collection Processing:
processCollection
processes image collections to find valid dates. -
Cloud Map Generation:
generateCloudMap
generates cloud coverage data for a series of dates. -
Querying:
queryAvailable
andgetAvailable
are used to query available images and their cloud coverage.
Performance Aspects
- Efficiency: The module uses Earth Engine's efficient image processing capabilities.
- Scalability: Designed to handle large collections of satellite images.
- Optimization: Cloud masking and filtering are optimized for performance.
Reusability
- Adaptability: Functions are modular and can be reused for different satellite missions and geometries.
- Extensibility: New missions or additional processing steps can be easily integrated.
Usage
- Image Processing: Used to process and filter satellite images based on cloud coverage.
- Data Analysis: Generates cloud maps and valid image acquisition dates for further analysis.
- Integration: Can be integrated into larger systems for environmental monitoring, agriculture, and other applications.
Assumptions
-
Image Metadata: Assumes images have specific metadata like
system:id
andCLOUDY_PIXEL_PERCENTAGE
. - Date Format: Assumes image IDs contain date information in a specific format.
- Geometry: Assumes valid geometric areas are provided for image processing.
- Mission Details: Assumes mission objects contain necessary details like name and cycle.
This analysis provides a comprehensive overview of the sentinel.js
module, detailing its structure, functionality, and usage within a larger system.
Flow Diagram [via mermaid]
graph TD
A[User] -->|Requests data| B[queryAvailable]
A[User] -->|Requests data| C[getAvailable]
A[User] -->|Requests data| D[acquire]
B -->|Calls| E[processCollection]
C -->|Calls| E[processCollection]
D -->|Calls| F[acquireFromDate]
E -->|Calls| G[retrieveExtremes]
E -->|Calls| H[addGridPosition]
E -->|Calls| I[sliceByRevisit]
E -->|Calls| J[getDate]
F -->|Calls| I[sliceByRevisit]
F -->|Calls| K[maskS2Clouds]
F -->|Calls| L[mergeProperties]
B -->|Returns data| A
C -->|Returns data| A
D -->|Returns data| A
Module: sentinel.js
sentinel.js
Comprehensive Analysis of Module Name
-
Module Name:
sentinel.js
Primary Objectives
- Purpose: The module is designed to interact with satellite imagery data, specifically Sentinel and Landsat missions, to process and filter images based on cloud coverage and other criteria. It provides functionalities to acquire images from specific dates, process collections of images, and generate cloud maps.
Critical Functions
- addGridPosition(element): Adds grid position metadata to an image.
- sliceByRevisit(collection, startingDate, days): Filters a collection of images by a date range.
- getImageDate(image): Extracts the date from an image's ID.
- maskS2Clouds(img, geometry, bandName, scale, imgDateParam): Masks clouds in Sentinel-2 images and calculates the cloud coverage ratio.
- acquireFromDate(date, mission, geometry): Acquires an image from a specific date and mission, applying cloud masking.
- processCollection(mission, geometry): Processes a collection of images to find valid dates for image acquisition.
- generateCloudMap(dates, mission, geometry): Generates a list of cloud coverage values for a series of dates.
- queryAvailable(mission): Returns a function that queries available images for a mission and geometry.
- getAvailable(mission): Returns a function that gets available images for a mission and geometry.
- acquire(mission): Returns a function that acquires an image for a specific date and geometry.
- format(properties): Formats image properties for display.
Key Variables
- Metadata.GRID_POSITION: Metadata key for grid position.
- bandName: Name of the band used for cloud masking.
- scale: Scale for cloud masking operations.
- geometry: Geometric area of interest for image processing.
- mission: Object containing mission details like name and cycle.
Interdependencies
-
Dependencies on Other Modules:
-
../../services/earth-engine
: Provides Earth Engine services. -
../utils
: Utility functions likemergeProperties
,retrieveExtremes
, andgetDate
. -
../../algorithms/satellite/landsat
: Specific functions for Landsat satellite data. -
../imagery
: Functions related to imagery processing. -
../../common/metadata
: Common metadata definitions.
-
Core vs. Auxiliary Operations
-
Core Operations:
acquireFromDate
processCollection
generateCloudMap
maskS2Clouds
-
Auxiliary Operations:
addGridPosition
sliceByRevisit
getImageDate
queryAvailable
getAvailable
acquire
format
Operational Sequence
-
Image Acquisition:
acquireFromDate
is used to acquire images from a specific date and mission. -
Cloud Masking:
maskS2Clouds
is applied to filter out cloud-covered areas. -
Collection Processing:
processCollection
processes a collection of images to find valid dates. -
Cloud Map Generation:
generateCloudMap
generates a list of cloud coverage values for a series of dates. -
Querying and Formatting:
queryAvailable
,getAvailable
, andformat
are used for querying and formatting image data.
Performance Aspects
-
Performance Considerations:
- Efficient filtering and masking of large image collections.
- Handling of large datasets with Earth Engine's
reduceRegion
andfilterDate
methods. - Use of
ee.Algorithms.If
andee.Number
for conditional operations and calculations.
Reusability
-
Adaptability for Reuse:
- The module is designed with reusable functions that can be adapted for different satellite missions and geometries.
- Functions like
maskS2Clouds
andacquireFromDate
can be reused with minor modifications for other satellite data.
Usage
-
How It Is Used:
- The module is used to acquire and process satellite images, specifically for cloud masking and date-based filtering.
- It can be integrated into larger systems for environmental monitoring, agricultural analysis, and other geospatial applications.
Assumptions
-
Assumptions Made:
- The input images have specific metadata fields like
system:id
andCLOUDY_PIXEL_PERCENTAGE
. - The Earth Engine service is available and accessible.
- The geometry provided for image processing is valid and correctly formatted.
- The mission object contains necessary details like
name
andcycle
.
- The input images have specific metadata fields like
This comprehensive analysis provides a detailed understanding of the sentinel.js
module, its functionalities, and its role within a larger system.
Flow Diagram [via mermaid]
graph TD
A[User] -->|Requests Data| B[queryAvailable]
A -->|Requests Data| C[getAvailable]
A -->|Requests Data| D[acquire]
A -->|Requests Data| E[format]
B -->|Calls| F[processCollection]
C -->|Calls| F[processCollection]
D -->|Calls| G[acquireFromDate]
E -->|Calls| H[format]
F -->|Uses| I[ee.ImageCollection]
F -->|Uses| J[retrieveExtremes]
F -->|Uses| K[addGridPosition]
F -->|Uses| L[sliceByRevisit]
F -->|Uses| M[mergeProperties]
F -->|Uses| N[getDate]
G -->|Uses| O[maskS2Clouds]
G -->|Uses| P[mergeProperties]
G -->|Uses| Q[sliceByRevisit]
G -->|Uses| R[acquireFromDateLandSat]
H -->|Uses| S[ee.Image]
H -->|Uses| T[ee.Dictionary]
style A fill:#f9f,stroke:#333,stroke-width:4px
style B fill:#bbf,stroke:#333,stroke-width:2px
style C fill:#bbf,stroke:#333,stroke-width:2px
style D fill:#bbf,stroke:#333,stroke-width:2px
style E fill:#bbf,stroke:#333,stroke-width:2px
style F fill:#ccf,stroke:#333,stroke-width:2px
style G fill:#ccf,stroke:#333,stroke-width:2px
style H fill:#ccf,stroke:#333,stroke-width:2px
style I fill:#ddf,stroke:#333,stroke-width:2px
style J fill:#ddf,stroke:#333,stroke-width:2px
style K fill:#ddf,stroke:#333,stroke-width:2px
style L fill:#ddf,stroke:#333,stroke-width:2px
style M fill:#ddf,stroke:#333,stroke-width:2px
style N fill:#ddf,stroke:#333,stroke-width:2px
style O fill:#eef,stroke:#333,stroke-width:2px
style P fill:#eef,stroke:#333,stroke-width:2px
style Q fill:#eef,stroke:#333,stroke-width:2px
style R fill:#eef,stroke:#333,stroke-width:2px
style S fill:#eef,stroke:#333,stroke-width:2px
style T fill:#eef,stroke:#333,stroke-width:2px