Skip to content
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

Merged
merged 2 commits into from
Mar 26, 2018
Merged

fix option line overriding #77

merged 2 commits into from
Mar 26, 2018

Conversation

emmaai
Copy link
Contributor

@emmaai emmaai commented Mar 26, 2018

With the requirement from Dale

@emmaai emmaai requested a review from uchchwhash March 26, 2018 02:43
@codecov-io
Copy link

codecov-io commented Mar 26, 2018

Codecov Report

Merging #77 into master will decrease coverage by 0.03%.
The diff coverage is 40%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
datacube_stats/tasks.py 69.58% <100%> (-0.16%) ⬇️
datacube_stats/main.py 41.88% <14.28%> (-1.65%) ⬇️
datacube_stats/statistics.py 50.1% <0%> (-2.58%) ⬇️
datacube_stats/utils/timer.py 59.67% <0%> (-1.73%) ⬇️
datacube_stats/schema.py 97.56% <0%> (+0.78%) ⬆️
datacube_stats/models.py 80.41% <0%> (+1.19%) ⬆️
datacube_stats/output_drivers.py 73.38% <0%> (+1.72%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 920f2ab...2703182. Read the comment docs.

@@ -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:
Copy link
Member

@uchchwhash uchchwhash Mar 26, 2018

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

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
Copy link
Member

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'))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed.

@uchchwhash
Copy link
Member

All good: 😄

@uchchwhash uchchwhash merged commit 6100174 into master Mar 26, 2018
@uchchwhash uchchwhash deleted the fix-option-line-overriding branch March 26, 2018 06:06
vnewey pushed a commit that referenced this pull request Apr 4, 2018
emmaai added a commit that referenced this pull request Apr 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants