-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix option line overriding #77
Conversation
Codecov Report
@@ Coverage Diff @@
## master #77 +/- ##
==========================================
- Coverage 55.35% 55.32% -0.04%
==========================================
Files 15 15
Lines 2184 2422 +238
==========================================
+ Hits 1209 1340 +131
- Misses 975 1082 +107
Continue to review full report at Codecov.
|
datacube_stats/main.py
Outdated
@@ -239,8 +239,11 @@ def from_configuration_file(cls, config, index=None, tile_indexes=None, output_l | |||
:return: read to run StatsApp | |||
""" | |||
input_region = config.get('input_region') | |||
if tile_indexes and not input_region: | |||
input_region = {'tiles': tile_indexes} | |||
if tile_indexes: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Notice that config.get('input_region')
might return None
since there
may be no input region specified. Both of the checks below will then crash.
So how about:
if tile_indexes is not None:
if input_region is None:
input_region = {'tiles': tile_indexes'}
elif 'geometry' in input_region:
input_region['tiles'] = tile_indexes
datacube_stats/tasks.py
Outdated
if input_region is None or input_region == {}: | ||
_LOG.info('No input_region specified. Generating full available spatial region, gridded files.') | ||
return GriddedTaskGenerator(storage) | ||
|
||
elif 'geometry' in input_region: # Larger spatial region |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is perfectly fine. However, notice that you could merge those
two branches into one:
return GriddedTaskGenerator(storage, geopolygon=geometry, tile_indexes=input_region.get('tiles'))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed.
All good: 😄 |
With the requirement from Dale