Commit 82797f0d authored by Gaëlle USSEGLIO's avatar Gaëlle USSEGLIO
Browse files

ENH : Robustify EOF selection by checking instrument (S1A or S1B)

parent 6356fe54
......@@ -496,9 +496,12 @@ if __name__ == "__main__":
if counter <= 1 :
start_master = dictKWLMaster['support_data.first_line_time']
end_master = dictKWLMaster['support_data.last_line_time']
# Get satellite number : S1A or S1B
sat_number_master = dictKWLMaster['manifest_data.instrument']
# Get a eof file
eof_file = func_utils.select_EofWithDate(start_master, end_master, list_ofEOF)
eof_file = func_utils.select_EofWithDate(start_master, end_master, list_ofEOF,
sat_number_master)
if (eof_file) :
# Create the new geom file into dedicated repository
......@@ -523,9 +526,11 @@ if __name__ == "__main__":
dictKWLSlave = func_utils.getImageKWL(slave_Image)
start_slave = dictKWLSlave['support_data.first_line_time']
end_slave = dictKWLSlave['support_data.last_line_time']
# Get satellite number : S1A or S1B
sat_number_slave = dictKWLSlave['manifest_data.instrument']
# Get a eof file
eof_file = func_utils.select_EofWithDate(start_slave, end_slave, list_ofEOF)
eof_file = func_utils.select_EofWithDate(start_slave, end_slave, list_ofEOF, sat_number_slave)
if (eof_file) :
# Create the new geom file into dedicated repository
......
......@@ -411,9 +411,11 @@ if __name__ == "__main__":
if counter <= 1 :
start_master = dictKWLMaster['support_data.first_line_time']
end_master = dictKWLMaster['support_data.last_line_time']
# Get satellite number : S1A or S1B
sat_number_master = dictKWLMaster['manifest_data.instrument']
# Get a eof file
eof_file = func_utils.select_EofWithDate(start_master, end_master, list_ofEOF)
eof_file = func_utils.select_EofWithDate(start_master, end_master, list_ofEOF, sat_number_master)
if (eof_file) :
# Create the new geom file into dedicated repository
......@@ -437,9 +439,11 @@ if __name__ == "__main__":
# slave
start_slave = dictKWLSlave['support_data.first_line_time']
end_slave = dictKWLSlave['support_data.last_line_time']
# Get satellite number : S1A or S1B
sat_number_slave = dictKWLSlave['manifest_data.instrument']
# Get a eof file
eof_file = func_utils.select_EofWithDate(start_slave, end_slave, list_ofEOF)
eof_file = func_utils.select_EofWithDate(start_slave, end_slave, list_ofEOF, sat_number_slave)
if (eof_file) :
# Create the new geom file into dedicated repository
......
......@@ -349,9 +349,11 @@ if __name__ == "__main__":
# master
start_master = dictKWLMaster['support_data.first_line_time']
end_master = dictKWLMaster['support_data.last_line_time']
# Get satellite number : S1A or S1B
sat_number_master = dictKWLMaster['manifest_data.instrument']
# Get a eof file
eof_file = func_utils.select_EofWithDate(start_master, end_master, list_ofEOF)
eof_file = func_utils.select_EofWithDate(start_master, end_master, list_ofEOF, sat_number_master)
if (eof_file) :
# Create the new geom file into dedicated repository
......@@ -376,9 +378,11 @@ if __name__ == "__main__":
dictKWLSlave = func_utils.getImageKWL(slave_Image)
start_slave = dictKWLSlave['support_data.first_line_time']
end_slave = dictKWLSlave['support_data.last_line_time']
# Get satellite number : S1A or S1B
sat_number_slave = dictKWLSlave['manifest_data.instrument']
# Get a eof file
eof_file = func_utils.select_EofWithDate(start_slave, end_slave, list_ofEOF)
eof_file = func_utils.select_EofWithDate(start_slave, end_slave, list_ofEOF, sat_number_slave)
if (eof_file) :
# Create the new geom file into dedicated repository
......
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
......@@ -314,8 +313,11 @@ if __name__ == "__main__":
start_master = dictKWLMaster['support_data.first_line_time']
end_master = dictKWLMaster['support_data.last_line_time']
# Get satellite number : S1A or S1B
sat_number_master = dictKWLMaster['manifest_data.instrument']
# Get a eof file
eof_file = func_utils.select_EofWithDate(start_master, end_master, list_ofEOF)
eof_file = func_utils.select_EofWithDate(start_master, end_master, list_ofEOF, sat_number_master)
if (eof_file) :
# Create the new geom file into dedicated repository
......@@ -340,9 +342,11 @@ if __name__ == "__main__":
dictKWLSlave = func_utils.getImageKWL(slave_Image)
start_slave = dictKWLSlave['support_data.first_line_time']
end_slave = dictKWLSlave['support_data.last_line_time']
# Get satellite number : S1A or S1B
sat_number_slave = dictKWLSlave['manifest_data.instrument']
# Get a eof file
eof_file = func_utils.select_EofWithDate(start_slave, end_slave, list_ofEOF)
eof_file = func_utils.select_EofWithDate(start_slave, end_slave, list_ofEOF, sat_number_slave)
if (eof_file) :
# Create the new geom file into dedicated repository
......
......@@ -561,7 +561,7 @@ def get_Tiff_WithDates(start, end, exclude, TiffList, ext=""):
date_list.append(i)
return date_list
def select_EofWithDate(start, end, eofList) :
def select_EofWithDate(start, end, eofList, sat_number="S1A") :
"""
Select into the input list, the file that correspond to dates
"""
......@@ -573,25 +573,29 @@ def select_EofWithDate(start, end, eofList) :
for i_eof in eofList:
# Without extension
i_eof = i_eof.split(".EOF")[0]
# Get sat number for current EOF file
sat_nb = i_eof.split('_')[0]
if sat_nb == sat_number :
start_eofDate = i_eof.split('_')[-2]
start_eofDate = start_eofDate.split("V")[1]
end_eofDate = i_eof.split('_')[-1]
# Without extension
i_eof = i_eof.split(".EOF")[0]
# Save date format
time_start_eofDate = time.mktime(time.strptime(start_eofDate,
"%Y%m%dT%H%M%S"))
start_eofDate = i_eof.split('_')[-2]
start_eofDate = start_eofDate.split("V")[1]
end_eofDate = i_eof.split('_')[-1]
time_end_eofDate = time.mktime(time.strptime(end_eofDate,
"%Y%m%dT%H%M%S"))
# Save date format
time_start_eofDate = time.mktime(time.strptime(start_eofDate,
"%Y%m%dT%H%M%S"))
time_end_eofDate = time.mktime(time.strptime(end_eofDate,
"%Y%m%dT%H%M%S"))
# Compare dates and return eof file if eof file contains the current image dates
if time_start >= time_start_eofDate and time_end <= time_end_eofDate :
return i_eof + ".EOF"
# Compare dates and return eof file if eof file contains the current image dates
if time_start >= time_start_eofDate and time_end <= time_end_eofDate :
return i_eof + ".EOF"
# if none of files contains wanted dates : return None
return None
......
Markdown is supported
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