Skip to content
Snippets Groups Projects
Commit 11fc59a7 authored by algodeveloper1@free.fr's avatar algodeveloper1@free.fr
Browse files

s3-download ingest notebook BIOMASS-2371

parent 569f164a
No related branches found
No related tags found
1 merge request!8Biomass 2371 ingest user data notebook
%% Cell type:markdown id:4de51eb6 tags: %% Cell type:markdown id:c20c96a7 tags:
<h1>Sample user data ingestion notebook</h1> <h1>Sample user data ingestion notebook</h1>
%% Cell type:markdown id:8b45f9ee tags: %% Cell type:markdown id:f5188e6b tags:
As a first step add the ingestion module location to path. In the future the ingestion module could be automatically put in the python module path. As a first step add the ingestion module location to path. In the future the ingestion module could be automatically put in the python module path.
%% Cell type:code id:5a994d73 tags: %% Cell type:code id:e09fede3 tags:
``` python ``` python
import os import os
import sys import sys
sys.path.insert(0, os.path.abspath('./user-data-ingest-scripts')) sys.path.insert(0, os.path.abspath('./user-data-ingest-scripts'))
``` ```
%% Cell type:markdown id:11cb449a tags: %% Cell type:markdown id:2608ef04 tags:
Then import the product ingestion utils from the edav_ingest module. The module uses the configuration information set in `/projects/.maap/edav.ini`. Then import the product ingestion utils from the edav_ingest module. The module uses the configuration information set in `/projects/.maap/edav.ini`.
It depends on rasterio and ipywidgets libraries that are currently not available in the conda environment. To prepare the environment the following commands were run before importing the script: It depends on rasterio and ipywidgets libraries that are currently not available in the conda environment. To prepare the environment the following commands were run before importing the script:
`conda install --freeze-installed rasterio` `conda install --freeze-installed rasterio`
`conda install --freeze-installed ipywidgets` `conda install --freeze-installed ipywidgets`
`jupyter labextension install @jupyter-widgets/jupyterlab-manager` `jupyter labextension install @jupyter-widgets/jupyterlab-manager`
%% Cell type:markdown id:3987a8cd tags: %% Cell type:markdown id:cc099be6 tags:
<h3>Local file ingestion</h3> <h3>Local file ingestion</h3>
First we run the local ingestion script passing the location of a local product file. This will generate a form. Complete the missing information and submit it to complete the ingestion. The function uses the `maap-s3.py` script internally to upload the product to S3 (in `[user_data_remote_s3_path]/[user_data_upload_location]/[USER_EMAIL]/` as specified in `/projects/.maap/edav.ini` e.g. `maap-scientific-data/shared/edav/edav_esa-maap.org`). Be sure it is available and that the information in `/projects/.maap/auth.ini` are correct First we run the local ingestion script passing the location of a local product file. This will generate a form. Complete the missing information and submit it to complete the ingestion. The function uses the `maap-s3.py` script internally to upload the product to S3 (in `[user_data_remote_s3_path]/[user_data_upload_location]/[USER_EMAIL]/` as specified in `/projects/.maap/edav.ini` e.g. `maap-scientific-data/shared/edav/edav_esa-maap.org`). Be sure it is available and that the information in `/projects/.maap/auth.ini` are correct
%% Cell type:code id:a089ae96 tags: %% Cell type:code id:eddc45b7 tags:
``` python ``` python
from edav_form import generateIngestionFormForLocalProduct from edav_form import generateIngestionFormForLocalProduct
generateIngestionFormForLocalProduct('/projects/data/georef_UK_classif.tif') generateIngestionFormForLocalProduct('/projects/data/georef_UK_classif.tif')
``` ```
%% Output %% Cell type:markdown id:bbef0ed1 tags:
%% Cell type:markdown id:bb1cbec4 tags:
<h3>Remote file ingestion</h3> <h3>Remote file ingestion</h3>
To ingest a product already on S3 user data location, run the remote ingestion script passing the relative location of the product (relative to the `user_data_local_s3_mount` set in `/projects/.maap/edav.ini`). The assumption is that the S3 location is locally mounted in the jupyter env (e.g. in /project/s3-drive/user-data, configurable in `/projects/.maap/edav.ini`) in order to extract the required information from the product metadata To ingest a product already on S3 user data location, run the remote ingestion script passing the relative location of the product (relative to the `user_data_local_s3_mount` set in `/projects/.maap/edav.ini`). The assumption is that the S3 location is locally mounted in the jupyter env (e.g. in /project/s3-drive/user-data, configurable in `/projects/.maap/edav.ini`) in order to extract the required information from the product metadata
%% Cell type:code id:13f4e740 tags: %% Cell type:code id:38621199 tags:
``` python ``` python
from edav_form import generateIngestionFormForRemoteProduct from edav_form import generateIngestionFormForRemoteProduct
generateIngestionFormForRemoteProduct('GPU_TEST_TIF/georef_Ecosse_classif_test.tiff') generateIngestionFormForRemoteProduct('GPU_TEST_TIF/georef_Ecosse_classif_test.tiff')
``` ```
%% Output %% Cell type:code id:6b397258 tags:
%% Cell type:code id:87872c47 tags:
``` python ``` python
``` ```
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment