Skip to content
Snippets Groups Projects
Commit c843713e authored by Levi Pfantz's avatar Levi Pfantz
Browse files

Update to take orbital_slot position from input files

parent db52055d
No related branches found
No related tags found
1 merge request!37Merge work from 1.1 into master
......@@ -66,7 +66,7 @@ warnings.filterwarnings("ignore")
import dask
dask.config.set(num_workers=1)
GOES_SAT_POSITIONS={'G16': 'east', 'G17': 'west', 'G18': 'west', 'G19': 'east',}
GOES_SUPPORTED_SATS=['G16', 'G17', 'G18', 'G19']
def create_parser():
......@@ -121,16 +121,19 @@ def get_resolution(args):
return resln
# if provided "auto" position, we determine the sensor from the filename
def get_goes_position(filenames):
def get_goes_position(files):
position=""
#Check that all files are the same position
for file in files:
new_position = Dataset(file, 'r').getncattr('orbital_slot')
if not position:
position=new_position
if not new_position == position:
raise ValueError("Input files contain a mix of positions. Check them and try again.")
position=position.split('-')[1]
return position.lower()
#Check that all files are the same sat
for key, value in GOES_SAT_POSITIONS.items():
if all(f"_{key}_" in f for f in filenames):
return value
# we require that all files are from the same sensor and raise an exception if not
raise ValueError("could not determine GOES position - did you provide a mix of satellites?")
def glm_filename_to_minute(glm_filename):
glminfo = parse_glm_filename(os.path.basename(glm_filename))
......
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