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

dict 10m, 20m, 60m et metadata

parent c1ff280f
No related branches found
No related tags found
No related merge requests found
FROM kosted/bmap-stack-python:1.0
RUN pip install property
WORKDIR /projects/{THE-NAME-OF-YOUR-PROJECT}
ADD . /projects/{THE-NAME-OF-YOUR-PROJECT}
ENTRYPOINT ["python3", "/projects/{THE-NAME-OF-YOUR-PROJECT}/src/sampleExample.py"]
README 0 → 100644
You have created a blank project.
This is really a blank project! This is the only file.
You can add files to your project:
1. Right click on the project tree.
2. In the Project menu.
3. Create files on the command line. Click the "+" button in the Console panel to open a terminal window.
You can perform install software, use the included version control tools, or run scaffolders like `rails` (if your workspace has it installed).
You can change the project type in `Project > Configuration`.
\ No newline at end of file
# Inputs
s2_folder = /projects/read_s2/input/MTD_MSIL2A.xml
# Outputs
output = /projects/data/read_s2/
bands_10m = Bands_10m.pkl
bands_20m = Bands_20m.pkl
bands_60m = Bands_60m.pkl
tile_meta = Tile_metadata.pkl
# Names of ground campaigns (e.g. biosar, tropisar, ...).
collection_Names=afrisar_onera
# Names of sub-regions (e.g. paracou, ...).
sub_region_names=La Lope
# Scene name
scene_name=lopeTB5
# Start date / end date to specify a range for the data acquisition date (e.g. 2007-12-03).
start_date=
# Start date / end date to specify a range for the data acquisition date (e.g. 2007-12-03).
end_date=
# Data product types (e.g. SLC, DEM, ...).
product_types=
# Instrument names used to capture the data (e.g. P-band, ...).
instrument_names=
# Data polarizations (e.g. HH, HV, ...).
polarizations=
# Data geometry types (e.g. non-geolocated ...).
geometry_types=
# Data processing levels (e.g. L0, L1, ...).
processing_levels=
#MANDATORY FIELDS
# User id (Find this number in the ESA MAAP portal, in the left panel > My account > Account Setings). mandatory
user_id=
# The path of the data (e.g. /projects/myProject/output/output_data_example.tiff). mandatory
data_path=
# The format of the data (e.g. AZ, RG, DEM,ROI, INC, KZ, GRD). mandatory
# Complex Data are not supported yet
product_type=
#OPTIONAL FIELDS
# Name of sub-region (e.g. La Lope, ...). optional
sub_region_name=
# Raster Data polarization (e.g. HH, HV, VV, VH). optional
polarization=
\ No newline at end of file
## Short description of the algorithm
## Description of data used
* Description of inputs
* Description of outputs
## Description of the different functions
* Function 1
* Short description
* Description of inputs
* Description of outputs
* Function 2
* Short description
* Description of inputs
* Description of outputs
This is a template of documentation. Please change each section by correct information
Headings
# This is an H1
## This is an H2
###### This is an H6
This is also an H1
==================
This is also an H2
------------------
Paragraphs
Paragraphs are separated by empty lines. To create a new paragraph, press <return> twice.
Paragraph 1
Paragraph 2
Character styles
*Italic characters*
_Italic characters_
**bold characters**
__bold characters__
~~strikethrough text~~
Unordered list
* Item 1
* Item 2
* Item 3
* Item 3a
* Item 3b
* Item 3c
Ordered list
1. Step 1
2. Step 2
3. Step 3
1. Step 3.1
2. Step 3.2
3. Step 3.3
List in list
1. Step 1
2. Step 2
3. Step 3
* Item 3a
* Item 3b
* Item 3c
Quotes or citations
Introducing my quote:
> Neque porro quisquam est qui
> dolorem ipsum quia dolor sit amet,
> consectetur, adipisci velit...
Inline code characters
Use the backtick to refer to a `function()`.
There is a literal ``backtick (`)`` here.
Code blocks
Indent every line of the block by at least 4 spaces.
This is a normal paragraph:
This is a code block.
With multiple lines.
Alternatively, you can use 3 backtick quote marks before and after the block, like this:
```
This is a code block
```
To add syntax highlighting to a code block, add the name of the language immediately
after the backticks:
```javascript
var oldUnload = window.onbeforeunload;
window.onbeforeunload = function() {
saveCoverage();
if (oldUnload) {
return oldUnload.apply(this, arguments);
}
};
```
Links to external websites
This is [an example](http://www.example.com/) inline link.
[This link](http://example.com/ "Title") has a title attribute.
Links are also auto-detected in text: http://example.com/
Images
Inline image syntax looks like this:
![Alt text](/path/to/image.jpg)
![Alt text](/path/to/image.png "Optional title attribute")
![Alt text](/url/to/image.jpg)
For example:
...
![Mockup for feature A](http://monosnap.com/image/bOcxxxxLGF.png)
...
Reference image links look like this:
![Alt text][id]
where 'id' is the name of a previously defined image reference, using syntax similar to link references:
[id]: url/to/image.jpg "Optional title attribute"
For example:
...
<--Collected image definitions-->
[MockupA]: http://monosnap.com/image/bOcxxxxLGF.png "Screenshot of Feature A mockup"
...
<!--Using an image reference-->
![Mockup for feature A][MockupA]
...
Tables
| Day | Meal | Price |
| --------|---------|-------|
| Monday | pasta | $6 |
| Tuesday | chicken | $8 |
Backslash escapes
Certain characters can be escaped with a preceding backslash to preserve the literal display of a character instead of its special Markdown meaning. This applies to the following characters:
\ backslash
` backtick
* asterisk
_ underscore
{} curly braces
[] square brackets
() parentheses
# hash mark
> greater than
+ plus sign
- minus sign (hyphen)
. dot
! exclamation mark
This diff is collapsed.
##########################################################################
if __name__ == '__main__':
##########################################################################
import os, sys
import numpy as np
os.sys.path.append('/projects/read_s2/src')
import re
from properties.p import Property
from xml.dom import minidom
import xml.etree.ElementTree as ET
if os.path.isfile('/projects/read_s2/conf/configuration.properties'):
configfile='/projects/read_s2/conf/configuration.properties'
prop=Property()
prop_dict=prop.load_property_files(configfile)
print("The configuration file is loaded")
output_path = prop_dict['output']
if not os.path.exists(output_path):
os.makedirs(output_path)
xml_metadata_path = prop_dict["s2_folder"]
metadata_tree = minidom.parse(xml_metadata_path)
root = metadata_tree.documentElement
dict_10m = {}
dict_20m = {}
dict_60m = {}
for element in root.getElementsByTagName('IMAGE_FILE'):
data_path = element.firstChild.data
if data_path.find('B02_10m') > 0:
dict_10m["B02"] = data_path + '.jp2'
if data_path.find('B03_10m') > 0:
dict_10m["B03"] = data_path + '.jp2'
if data_path.find('B04_10m') > 0:
dict_10m["B04"] = data_path + '.jp2'
if data_path.find('B05_20m') > 0:
dict_20m["B05"] = data_path + '.jp2'
if data_path.find('B06_20m') > 0:
dict_20m["B06"] = data_path + '.jp2'
if data_path.find('B07_20m') > 0:
dict_20m["B07"] = data_path + '.jp2'
if data_path.find('B08_10m') > 0:
dict_10m["B08"] = data_path + '.jp2'
if data_path.find('B08A_20m') > 0:
dict_20m["B08A"] = data_path + '.jp2'
if data_path.find('B09_60m') > 0:
dict_60m["B09"] = data_path + '.jp2'
if data_path.find('B11_20m') > 0:
dict_20m["B11"] = data_path + '.jp2'
if data_path.find('B12_20m') > 0:
dict_20m["B12"] = data_path + '.jp2'
import pickle
with open(output_path + os.sep + prop_dict['bands_10m'], 'wb') as save_10m :
pickle.dump(dict_10m, save_10m)
print('Bands_10m.pkl : Done')
with open(output_path + os.sep + prop_dict['bands_20m'], 'wb') as save_20m :
pickle.dump(dict_20m, save_20m)
print('Bands_20m.pkl : Done')
with open(output_path + os.sep + prop_dict['bands_60m'], 'wb') as save_60m :
pickle.dump(dict_60m, save_60m)
print('Bands_60m.pkl : Done')
dict_metadata = {}
dict_metadata['PROCESSING_LEVEL'] = root.getElementsByTagName('PROCESSING_LEVEL')[0].firstChild.nodeValue
dict_metadata['PRODUCT_TYPE'] = root.getElementsByTagName('PRODUCT_TYPE')[0].firstChild.data
dict_metadata['GENERATION_TIME'] = root.getElementsByTagName('GENERATION_TIME')[0].firstChild.data
dict_metadata['NODATA_PIXEL_PERCENTAGE'] = root.getElementsByTagName('NODATA_PIXEL_PERCENTAGE')[0].firstChild.nodeValue
dict_metadata['SATURATED_DEFECTIVE_PIXEL_PERCENTAGE'] = root.getElementsByTagName('SATURATED_DEFECTIVE_PIXEL_PERCENTAGE')[0].firstChild.data
dict_metadata['DARK_FEATURES_PERCENTAGE'] = root.getElementsByTagName('DARK_FEATURES_PERCENTAGE')[0].firstChild.data
dict_metadata['CLOUD_SHADOW_PERCENTAGE'] = root.getElementsByTagName('CLOUD_SHADOW_PERCENTAGE')[0].firstChild.nodeValue
dict_metadata['VEGETATION_PERCENTAGE'] = root.getElementsByTagName('VEGETATION_PERCENTAGE')[0].firstChild.data
dict_metadata['NOT_VEGETATED_PERCENTAGE'] = root.getElementsByTagName('NOT_VEGETATED_PERCENTAGE')[0].firstChild.data
dict_metadata['WATER_PERCENTAGE'] = root.getElementsByTagName('WATER_PERCENTAGE')[0].firstChild.nodeValue
dict_metadata['UNCLASSIFIED_PERCENTAGE'] = root.getElementsByTagName('UNCLASSIFIED_PERCENTAGE')[0].firstChild.data
dict_metadata['MEDIUM_PROBA_CLOUDS_PERCENTAGE'] = root.getElementsByTagName('MEDIUM_PROBA_CLOUDS_PERCENTAGE')[0].firstChild.data
dict_metadata['HIGH_PROBA_CLOUDS_PERCENTAGE'] = root.getElementsByTagName('HIGH_PROBA_CLOUDS_PERCENTAGE')[0].firstChild.nodeValue
dict_metadata['THIN_CIRRUS_PERCENTAGE'] = root.getElementsByTagName('THIN_CIRRUS_PERCENTAGE')[0].firstChild.data
dict_metadata['SNOW_ICE_PERCENTAGE'] = root.getElementsByTagName('SNOW_ICE_PERCENTAGE')[0].firstChild.data
PRODUCT_URI = root.getElementsByTagName('PRODUCT_URI')[0].firstChild.data
dict_metadata['TILE_DATE'] = PRODUCT_URI[11:19]
dict_metadata['TILE_NAME'] = PRODUCT_URI[38:44]
with open(output_path + os.sep + prop_dict['tile_meta'], 'wb') as meta :
pickle.dump(dict_metadata, meta)
print('Tile_metadata.pkl : Done')
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