Skip to content
Snippets Groups Projects
Commit 4705f78c authored by pascal.mouquet_ird.fr's avatar pascal.mouquet_ird.fr
Browse files

example scripts update

parent 5b196ac2
No related branches found
No related tags found
No related merge requests found
pre1_pre2_starttime_pre3_pre4_tile_pre5_endtime_maxclouds_site_nom_indices
#~ S2A_MSIL1C_20161023T070232_N0204_R120_T39LUG_20161023T070234
#~ S2A_MSIL1C_20160611T072212_N0202_R063_T38KLB_20160611T072355
#~ S2A_MSIL1C_20160621T072212_N0204_R063_T38KME_20160621T072212
#~ S2A_MSIL1C_20160608T071222_N0202_R020_T38KLV_20160608T071512
#~ S2A_MSIL1C_20160608T071222_N0202_R020_T38KMD_20160608T071219
#~ S2A_MSIL1C_20160621T072212_N0204_R063_T38KLF_20160621T072212
#~ S2A_MSIL1C_20160628T071222_N0204_R020_T38JMT_20160628T071217
#~ S2A_MSIL1C_20160611T072212_N0202_R063_T38KMC_20160611T072355
#~ S2A_MSIL1C_20160608T071222_N0202_R020_T38KLU_20160608T071512
#~ S2A_MSIL1C_20160628T071222_N0204_R020_T38JLT_20160628T071217
#~ S2A_MSIL1C_20161108T072212_N0204_R063_T38KLA_20161108T072535
#~ S2A_MSIL1C_20160516T070242_N0202_R120_T39LTG_20160516T070240
#~ S2A_MSIL1C_20160516T070242_N0202_R120_T39LTF_20160516T070240
#~ S2A_MSIL1C_20160516T070242_N0202_R120_T38LRK_20160516T070240
#~ S2A_MSIL1C_20160708T071222_N0204_R020_T38LRK_20160708T071218
#~ S2A_MSIL1C_20160715T070242_N0204_R120_T38LRL_20160715T070238
#~ S2A_MSIL1C_20160715T070242_N0204_R120_T39LTF_20160715T070238
#~ S2A_MSIL1C_20160830T072212_N0204_R063_T38KMG_20160830T072348
#~ S2A_MSIL1C_20160817T071222_N0204_R020_T38LNH_20160817T071218
#~ S2A_MSIL1C_20160817T071222_N0204_R020_T38LPJ_20160817T071218
#~ S2A_MSIL1C_20160817T071222_N0204_R020_T38LQJ_20160817T071218
#~ S2A_MSIL1C_20160827T071222_N0204_R020_T38LQH_20160827T071227
#~ S2A_MSIL1C_20160827T071222_N0204_R020_T38LPH_20160827T071401
#~ S2A_MSIL1C_20160827T071222_N0204_R020_T38LPH_20160827T071227
#~ S2A_MSIL1C_20160830T072212_N0204_R063_T38LMH_20160830T072348
#~ S2A_MSIL1C_20160906T071212_N0204_R020_T38LRJ_20160906T071214
#~ S2A_MSIL1C_20160926T071212_N0204_R020_T38KMC_20160926T071210
#~ S2A_MSIL1C_20160926T071212_N0204_R020_T38KLC_20160926T071210
#~ S2A_MSIL1C_20161108T072212_N0204_R063_T38KLA_20161108T072535
# L1C identifier list
S2A_MSIL1C_20160830T072212_N0204_R063_T38KLE_20160830T072348
S2A_MSIL1C_20160909T072212_N0204_R063_T38KLF_20160909T072258
S2A_MSIL1C_20161029T072212_N0204_R063_T38KME_20161029T072230
S2A_MSIL1C_20161003T070232_N0204_R120_T39LUC_20161003T070230
S2A_MSIL1C_20161003T070232_N0204_R120_T39LVC_20161003T070230
S2A_MSIL1C_20161003T070232_N0204_R120_T39LUC_20161003T070230
# -*- coding:utf-8 -*-
""" lance les traitements sur les fichiers L1C qui ont
été téléchargés mais qui n'ont pas été traités
""" Process L1C products by identifiers
Input : - an identifier list in a csv file
- a Sen2chain L1C library
Output : L2A / indices
If any argument is supplied nothiing is done, this script outputs only a product list to process but without any processing
This script uses multiprocessing to process files.
Please adapt the number of process lines 65, 79, 96 according to your hardware
Please refer to sen2chain wiki for more info : https://framagit.org/jebins/sen2chain/wikis/home
"""
import logging
import datetime
import pandas as pd
......@@ -19,18 +30,18 @@ except:
arg = []
print(arg)
logger = logging.getLogger("Traitement L2A")
logger = logging.getLogger("L2A Processing")
logging.basicConfig(level=logging.INFO)
logger.setLevel(logging.INFO)
# default nombre de jours à requeter à partir de today
# si le champs n'est pas renseingné ds le csv
# default number of days to check before today
# if this field is empty in the csv file
delta_t = 15
# liste de tuiles à traiter
# file path to tile identifiers list to process
fwd = os.path.dirname(os.path.realpath(__file__))
tiles_file = fwd + "/97_02_traitement_l2a_identifier_multiprocessing.csv"
tiles_file = fwd + "/process_l2a_and_indices_by_identifier_multiprocessing.csv"
tiles_list = pd.read_csv(tiles_file, sep = '_', na_values="", na_filter=False, comment='#')
......@@ -45,15 +56,7 @@ for index, row in tiles_list.iterrows():
logger.info("\n{}".format(tiles_list))
# Nettoyage de la librairie
clean_list = []
for index, row in tiles_list.iterrows():
clean_list.append(row.tile)
lib = Library()
lib.clean(clean_list, remove=True)
# Traitement des L1C en L2A
# Processing L1C to L2A
l1c_process_list = []
for index, row in tiles_list.iterrows():
t = Tile(row.tile)
......@@ -67,7 +70,7 @@ if l1c_process_list:
l2a_res = l2a_multiprocessing(l1c_process_list, nb_proc=12)
# Traitement des L2A (clouds)
# Processing L2A cloud masks
cld_l2a_process_list = []
for index, row in tiles_list.iterrows():
t = Tile(row.tile)
......@@ -81,7 +84,7 @@ if cld_l2a_process_list:
cld_res = cld_multiprocessing(cld_l2a_process_list, nb_proc=4)
# Traitement des L2A (indices)
# Processing L2A indices
indices_l2a_process_list = []
for index, row in tiles_list.iterrows():
t = Tile(row.tile)
......
tile;start_time;end_time;max_clouds;site;nom;indices
40KCB;2018-10-01;;;France;Reunion;NDVI/NDWIGAO/NDWIMCF/MNDWI/BIGR/BIRNIR/BIBG
#~ 40KEC;2019-01-01;;;Maurice;Maurice
#~ 41KNU;2019-03-01;;;Maurice;Rodrigues;NDVI/NDWIGAO/NDWIMCF/BIGR/BIRNIR/BIBG
#~ 38LML;2019-01-01;;;France;Mayotte
#~ 38LNL;2019-01-01;;;France;Mayotte
#~ 38LNM;2019-01-01;;;France;Mayotte
#~ 38LMM;2019-01-01;;;Comores;Anjouan_MAY
#~ 38LLN;2019-01-01;;;Comores;Grande_Comores
#~ 38LLM;2019-01-01;;;Comores;GC_Moheli
#~ #37KFR;2015-01-01;2020-01-01;;TAAF_Eparses;Europa
#~ #37KES;2015-01-01;2020-01-01;;TAAF_Eparses;Bassas
#~ #38KKG;;;;TAAF_Eparses;Juan
#~ #38LPM;20190101;;;TAAF_Eparses;Geyser_Zelee
#~ #38LQN;;;;TAAF_Eparses;Glorieuses
#~ #40MCV;;;;Seychelles;Mahe
#~ #40MCA;;;;Seychelles;Praslin
#~ 38LPQ;2019-01-01;;;Seychelles;Aldabra
#~ #38LQQ;;;;Seychelles;Cosmoledo_Cosmoledo
#~ #38LQP;;;;Seychelles;Cosmoledo_Astove
#~ #39GWJ;;;;TAAF_Subantarctique;Crozet_Possession
#~ #39GVJ;;;;TAAF_Subantarctique;Crozet_Cochons_Manchots
#~ #39GVK;;;;TAAF_Subantarctique;Crozet_Cochons_Apotres
#~ #42FXL;;;;TAAF_Subantarctique;Kerguelen_E
#~ #42FWL;;;;TAAF_Subantarctique;Kerguelen_C
#~ #42FVL;;;;TAAF_Subantarctique;Kerguelen_W
#~ #42FVM;;;;TAAF_Subantarctique;Kerguelen_NW
#~ #42FWM;;;;TAAF_Subantarctique;Kerguelen_NC
#~ 38KLA;2019-01-01;;;Madagascar;Morombe;NDVI/NDWIGAO/NDWIMCF/MNDWI/BIGR/BIRNIR/BIBG
#~ 38KQE;;;;Madagascar;Tana
#~ 38KQD;;;;Madagascar;Sud_Tana
#~ 38KRE;;;;Madagascar;Est_Tana
#~ 38KRD;;;;Madagascar;Sud-Est_Tana
# max_clouds parameter not implemented yet
40KCB;2018-10-01;2018-11-01;;France;Reunion;NDVI/NDWIGAO/NDWIMCF/MNDWI/BIGR/BIRNIR/BIBG
# -*- coding:utf-8 -*-
""" lance les traitements sur les fichiers L1C qui ont
été téléchargés mais qui n'ont pas été traités
""" Process L1C products
Input : - a tile list in a csv file (tile;start_time;end_time;max_clouds;site;nom;indices)
- a Sen2chain L1C library
Output : L2A / indices
If any argument is supplied nothiing is done, this script outputs only a product list to process but without any processing
This script uses multiprocessing to process files.
Adapt the number of process (lines 65, 79, 96) according to your hardware
Please refer to sen2chain wiki for more info : https://framagit.org/jebins/sen2chain/wikis/home
"""
import logging
import datetime
import pandas as pd
from sen2chain import Tile, L1cProduct, L2aProduct
from sen2chain import l2a_multiprocessing, cldidx_multiprocessing, cld_multiprocessing, idx_multiprocessing
import os, shutil, sys
import glob
import math
from sen2chain import Tile
from sen2chain import l2a_multiprocessing, cld_multiprocessing, idx_multiprocessing
import os, sys
from itertools import chain
try:
......@@ -19,18 +28,18 @@ except:
arg = []
print(arg)
logger = logging.getLogger("Traitement L2A")
logger = logging.getLogger("L2A Prcessing")
logging.basicConfig(level=logging.INFO)
logger.setLevel(logging.INFO)
# default nombre de jours à requeter à partir de today
# si le champs n'est pas renseingné ds le csv
# default number of days to check before today
# if this field is empty in the csv file
delta_t = 15
# liste de tuiles à traiter
# file path to tile list to process
fwd = os.path.dirname(os.path.realpath(__file__))
tiles_file = fwd + "/99_traitement_l2a_multiprocessing.csv"
tiles_file = fwd + "/process_l2a_and_indices_multiprocessing.csv"
tiles_list = pd.read_csv(tiles_file, sep = ';', na_values="", na_filter=False, comment='#')
......@@ -45,7 +54,7 @@ for index, row in tiles_list.iterrows():
logger.info("\n{}".format(tiles_list))
# Traitement des L1C en L2A
# Processing L1C to L2A
l1c_process_list = []
for index, row in tiles_list.iterrows():
t = Tile(row.tile)
......@@ -59,7 +68,7 @@ if l1c_process_list:
l2a_res = l2a_multiprocessing(l1c_process_list, nb_proc=12)
# Traitement des L2A (clouds)
# Processing L2A cloud masks
cld_l2a_process_list = []
for index, row in tiles_list.iterrows():
t = Tile(row.tile)
......@@ -73,7 +82,7 @@ if cld_l2a_process_list:
cld_res = cld_multiprocessing(cld_l2a_process_list, nb_proc=4)
# Traitement des L2A (indices)
# Processing L2A indices
indices_l2a_process_list = []
for index, row in tiles_list.iterrows():
t = Tile(row.tile)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment