Skip to content

Commit 6c2321b

Browse files
authored
Merge pull request #462 from BANANAPEEL202/fix-product-validation
fix product validation
2 parents 43792b0 + 42a584f commit 6c2321b

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

src/herbie/core.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -223,16 +223,6 @@ def __init__(
223223
# (see https://stackoverflow.com/a/7936588/2383070 for what I'm doing here)
224224
getattr(model_templates, self.model).template(self)
225225

226-
if product is None:
227-
# The user didn't specify a product, so let's use the first
228-
# product in the model template.
229-
self.product = list(self.PRODUCTS)[0]
230-
log.info(f'`product` not specified. Will use "{self.product}".')
231-
# We need to rerun this so the sources have the new product value.
232-
getattr(model_templates, self.model).template(self)
233-
234-
self.product_description = self.PRODUCTS[self.product]
235-
236226
# Specify the suffix for the inventory index files.
237227
# Default value is `.grib2.idx`, but some have weird suffix,
238228
# like archived RAP on NCEI are `.grb2.inv`.
@@ -246,9 +236,19 @@ def __init__(
246236

247237
self.search_help = _search_help(self.IDX_STYLE)
248238

239+
if product is None:
240+
# The user didn't specify a product, so let's use the first
241+
# product in the model template.
242+
self.product = list(self.PRODUCTS)[0]
243+
log.info(f'`product` not specified. Will use "{self.product}".')
244+
# We need to rerun this so the sources have the new product value.
245+
getattr(model_templates, self.model).template(self)
246+
249247
# Check the user input
250248
self._validate()
251249

250+
self.product_description = self.PRODUCTS[self.product]
251+
252252
# Ok, now we are ready to look for the GRIB2 file at each of the remote sources.
253253
# self.grib is the first existing GRIB2 file discovered.
254254
# self.idx is the first existing index file discovered.

0 commit comments

Comments
 (0)