From 98b22aac6b25b041f04898c14371e430b864ee53 Mon Sep 17 00:00:00 2001 From: Jason Wang Date: Wed, 21 Aug 2024 09:50:23 -0500 Subject: [PATCH] use dataset instead of single frame for guessing recipes --- corgidrp/walker.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/corgidrp/walker.py b/corgidrp/walker.py index 9986eb54..43b6ba38 100644 --- a/corgidrp/walker.py +++ b/corgidrp/walker.py @@ -66,12 +66,13 @@ def autogen_recipe(filelist, outputdir, template=None): Returns: json: the JSON recipe to process the filelist """ - # load the first frame to check what kind of data and identify recipe - first_frame = data.autoload(filelist[0]) + # load the data to check what kind of recipe it is + dataset = data.Dataset(filelist) + first_frame = dataset[0] # if user didn't pass in template if template is None: - recipe_filename = guess_template(first_frame) + recipe_filename = guess_template(dataset) # load the template recipe recipe_filepath = os.path.join(recipe_dir, recipe_filename) @@ -107,16 +108,17 @@ def autogen_recipe(filelist, outputdir, template=None): return recipe -def guess_template(image): +def guess_template(dataset): """ Guesses what template should be used to process a specific image Args: - image (corgidrp.data.Image): an Image file to process + dataset (corgidrp.data.Dataset): a Dataset to process Returns: str: the best template filename """ + image = dataset[0] # first image for convenience if image.ext_hdr['DATA_LEVEL'] == "L1": if image.pri_hdr['OBSTYPE'] == "ENG": recipe_filename = "l1_to_l2a_eng.json"