Skip to content
Snippets Groups Projects
Commit 8620a76a authored by abir.chebbi's avatar abir.chebbi
Browse files

add doc

parent 27462578
Branches
No related tags found
No related merge requests found
...@@ -10,9 +10,6 @@ This project aims to calculate the average NDVI for Argentina using AWS Step Fun ...@@ -10,9 +10,6 @@ This project aims to calculate the average NDVI for Argentina using AWS Step Fun
The NDVI images, sourced from the 'ndvi-satellite-images' S3 bucket, are provided by NASA satellites with a resolution of 256x256 pixels, representing bi-weekly NDVI values. Image filenames follow the "argentina_date.tif" pattern, with dates formatted as a four-digit year followed by a three-digit day of the year. The NDVI images, sourced from the 'ndvi-satellite-images' S3 bucket, are provided by NASA satellites with a resolution of 256x256 pixels, representing bi-weekly NDVI values. Image filenames follow the "argentina_date.tif" pattern, with dates formatted as a four-digit year followed by a three-digit day of the year.
The following image represent the application workflow. Each step in the flowchart is represented with a state in the step functions:
![Step function workflow](/wokflow%20faas.png)
...@@ -56,4 +53,39 @@ Add a custom layer named **matplotlib**. This layer should include the rioxarray ...@@ -56,4 +53,39 @@ Add a custom layer named **matplotlib**. This layer should include the rioxarray
3. Function Code: 3. Function Code:
In the Lambda function's code editor, paste the contents of the **Plot NDVI Time Series.py** script. This script contains the logic to plot the results, save it into png format and put it in S3 bucket. In the Lambda function's code editor, paste the contents of the **Plot NDVI Time Series.py** script. This script contains the logic to plot the results, save it into png format and put it in S3 bucket.
### Step function
The following image represent the application workflow. Each step in the flowchart is represented with a state in the step functions:
![Step function workflow](/wokflow%20faas.png)
#### Step 1: Create State Machine
Log into the AWS Management Console and navigate to the AWS Step Functions page.
Click on Create state machine to start the process of creating your workflow template.
#### Step 2: Design Workflow Visually
Choose **Design your workflow visually** to open the visual workflow editor. This option allows you to construct your state machine using a drag-and-drop interface.
#### Step 3: Choose State Machine Type
Select the **Standard** type for the state machine. If unsure about which type to select, click on Help me decide for a detailed comparison between **Standard** and **Express** types.
After selecting the type, click Next to proceed to the workflow studio.
#### Step 4: Use Flow Control
Inside the workflow studio, navigate to the left-hand panel and select **Flow** control.
Choose **Map**, which allows for parallel processing. Note that based on your workflow, you might not need to use Map if there's no parallel processing required.
#### Step 5: Configure a state to compute NDVI mean
Drag and drop AWS Lambda from the Actions panel to add a task to invoke your Lambda function.
Configure the task with the name of the Lambda function that computes the mean. Set the Payload option to use the state's input as the payload for the Lambda function.
#### Step 6: Add Choice Flow
Drag and drop the Choice state onto your workflow to create a branching logic.
Configure the Choice state by adding rules:
* Click Add new rule.
* Set a condition by choosing the variable $.type.
* For the operator, select is exactly and set the value to a String constant of "CSV" for the first condition.
* Repeat the process for the second rule and set the value to "PNG".
#### Step 7: Configure Lambda Tasks for the Condition
Under each condition you've set in the Choice state, you will add the respective Lambda tasks:
For CSV, drag another Lambda function onto the workflow and configure it to invoke the function that processes the data and outputs it to a CSV file.
For PNG, do the same for the Lambda function that processes the data and outputs it to a PNG file.
#### Step 8: Save and Test
Once all the states are configured correctly, Save the state machine.
Test your state machine by starting an execution and monitoring the results to ensure that it behaves as expected.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment