Skip to content
Snippets Groups Projects
Commit 3f008b2f authored by edupin's avatar edupin
Browse files

working private data ingestion

parent 623faef8
No related branches found
No related tags found
No related merge requests found
......@@ -78,9 +78,10 @@ COPY quicklook_raster.py /usr/bmap/quicklook_raster.py
COPY ingestData.py /usr/bmap/ingestData.py
COPY ingestData.sh /usr/bmap/ingestData.sh
#RUN sudo chmod +x /usr/bmap/initTemplate.sh
#RUN sudo chmod +x /usr/bmap/shareAlgorithm.sh
#RUN sudo chmod +x /usr/bmap/ingestData.sh
USER root
RUN chmod +x /usr/bmap/initTemplate.sh
RUN chmod +x /usr/bmap/shareAlgorithm.sh
RUN chmod +x /usr/bmap/ingestData.sh
ENV PATH="/usr/bmap/:${PATH}"
ENV PYTHONPATH="/usr/bmap/:${PYTHONPATH}"
#We add env variable to request the back end
......
# Names of sub-regions (e.g. paracou, ...).
sub_region_name=La Lope
#MANDATORY FIELDS
# Data polarization (e.g. HH, HV, VV, VH).
polarization=HH
# User id (Find this number in the ESA MAAP portal, in the left panel > My account > Account Setings). mandatory
user_id=
# User id (Find this number in the ESA MAAP portal, in the left panel > My account > Account Setings).
user_id=20164
# The path of the data (e.g. /projects/myProject/output/output_data_example.tiff). mandatory
data_path=
# The path of the data (e.g. /projects/myproject/output/mydata.tiff).
data_path=/projects/SharePrivateData/output/output_data_example.tiff
# The format of the data (e.g. AZ, RG, DEM,ROI, SLC_HH, SLC_VV, SLC_VH, SLC_HV, INC, KZ). mandatory
data_format=
# The format of the data (e.g. AZ, RG, DEM,ROI, SLC_HH, SLC_VV, SLC_VH, SLC_HV, INC, KZ).
data_format=KZ
\ No newline at end of file
#OPTIONAL FIELDS
# Name of sub-region (e.g. paracou, ...). optional
sub_region_name=
# Raster Data polarization (e.g. HH, HV, VV, VH). optional
polarization=
\ No newline at end of file
......@@ -66,11 +66,13 @@ def ingestPrivateData(propertiesPath):
if len(polarization) > 0:
criteria_list['polarization'] = polarization
print(' 2.4- The polarization is '+ polarization)
'''
else:
criteria_list['polarization'] = None
'''
allVariableAreFilled = False;
print(' 2.4- The polarization is mandatory')
'''
except:
pass
......@@ -80,11 +82,14 @@ def ingestPrivateData(propertiesPath):
if len(sub_region_name) > 0:
criteria_list['subregionName'] = sub_region_name
print(' 2.5- The sub region is '+ sub_region_name)
'''
else:
'''
allVariableAreFilled = False;
print(' 2.5- The sub region is mandatory')
'''
'''
criteria_list['subregionName'] = None
except:
pass
'''
......@@ -132,7 +137,7 @@ def ingestPrivateData(propertiesPath):
######We call the back end service to start the ingestion
ingestTheData(criteria_list, folder_destination+"/"+os.path.basename(criteria_list['dataPath']))
else:
print("Please, fill all the mandatories variables !!!!!!!!")
print("Not all mandatory fields are filled.")
#########Function to call the back end and check the id of the user
......@@ -165,11 +170,14 @@ def sendARequest(url) :
print('ERROR: ' + str(e))
logging.error(str(e))
#########################################################################
def ingestTheData(criteria_list):
def ingestTheData(criteria_list, destination):
print('5- Your metadata are : ' + str(criteria_list))
url = url_root + "catalogue/granule/private/add?dataPath=" + criteria_list['dataPath'] + "&subregionName=" + criteria_list['subregionName'] + "&polarization=" +criteria_list['polarization'] + "&dataFormat=" + criteria_list['dataFormat'] + "&collectionName=" + criteria_list['collectionName'] + "&userId=" + str(criteria_list['userId'])
#print(url)
print('destination')
url = url_root + "catalogue/granule/private/add?dataPath=" + destination + "&dataFormat=" + criteria_list['dataFormat'] + "&userId=" + str(criteria_list['userId'])
print(url)
#"&subregionName=" + criteria_list['subregionName'] +
#+ "&polarization=" +criteria_list['polarization']
response = requests.get(url)
json_str = response.text
code = response.status_code
......@@ -191,9 +199,9 @@ def isROIfileExistAll(datapath) :
for i in range(len(listeOfRoi)):
filePath = listeOfRoi[i]
if Path(filePath).is_file():
print("ROI file find "+filePath)
print("ROI file found at "+filePath)
else:
print("The ROI file is missing "+filePath)
print("A mandatory ROI file is missing "+filePath)
listeEmpty = []
return listeEmpty
......
#!/bin/bash
# Ask the user for the path of the project
echo "Hello, please enter the path of the sharedata properties"
echo -n "The path of the sharedata.properties of your project. It should be in /projects/THE_NAME_YOU_MUST_CHANGE/conf/sharedata.properties :"
read propertiesPath
echo "===> The path is : " $propertiesPath
python /usr/bmap/ingestData.py $propertiesPath
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