How to use the MaapDataStore library - Help
How to use the MaapDataStore library
The MaapDataStore library is a library provided in the BMAAP Python stack which you can import and use in your workspace like a basic python library.
To better follow this tutorial, you can clone this project: https://gitlab-val.biomass-maap.com/algodeveloper1/tuto.git in your development environment. This project contains 3 scripts: download.py, metadata.py and read.py
If you don't know how to clone a project in your Eclipse, please read the 'Duplicate a git project repository' help page.
MaapDataStore is a library which has been created to help users to access to data and metadata in his eclipse che workspace. It is composed of 2 functions:
This function is used to download a data in your workspace. It takes 2 arguments, the first is the ID of the data and the second is the path where you want to save your data. (You can obtain the ID of a Data in the Explore page)
In the tuto project, you can open an example of this function with the 'download' python code.
You can replace To Complete with the Data ID by this ID and To complete with the Data name by this name afrisar_dlr_T2-0_dem_dem.tiff
In your terminal, launch the code with the following command: $python /tuto/src/download.py
A message appears to let you know the data is downloaded in required directory :
This function is used to get metadata of your data. It takes 2 arguments:
- the first is the path of your datacriteria.properties file
- the second is the path where you have downloaded the data.
The datacriteria.properties contains the search criteria. You must complete 3 mandatory parameters: collection_name, sub_region_name and scene_name.
The data path is only used if you have downloaded data in a directory and you want to provide the path. If it is not the case, you can provide an empty path.
The read.py script is an example to use the get_granule_by_criteria function. You can launch it with the following command: $python tuto/src/read.py