Skip to content

Commit

Permalink
pep8
Browse files Browse the repository at this point in the history
  • Loading branch information
nilshempelmann committed Jan 7, 2019
1 parent d3bb908 commit e989ab3
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
6 changes: 3 additions & 3 deletions eggshell/eo/gdal_merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ def GetOutputDriversFor(filename):
ext = GetExtension(filename)
for i in range(gdal.GetDriverCount()):
drv = gdal.GetDriver(i)
if (drv.GetMetadataItem(gdal.DCAP_CREATE) is not None or
drv.GetMetadataItem(gdal.DCAP_CREATECOPY) is not None) and drv.GetMetadataItem(gdal.DCAP_RASTER) is not None:
if (drv.GetMetadataItem(gdal.DCAP_CREATE) is not None
or drv.GetMetadataItem(gdal.DCAP_CREATECOPY) is not None) and drv.GetMetadataItem(gdal.DCAP_RASTER) is not None:
if len(ext) > 0 and DoesDriverHandleExtension(drv, ext):
drv_list.append(drv.ShortName)
else:
Expand Down Expand Up @@ -530,7 +530,7 @@ def main(argv=None):
for fi in file_infos:
bands = bands + fi.bands
if t_fh.RasterCount < bands:
print('Existing output file has less bands than the input files.)
print('Existing output file has less bands than the input files.')
print('You should delete it before. Terminating gdal_merge.')
sys.exit(1)
else:
Expand Down
3 changes: 1 addition & 2 deletions eggshell/nc/nc_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from datetime import datetime as dt
# TODO: change to nc_utils guess_main_variables
# from eggshell.nc.ocg_utils import get_variable
import time
import logging
import os
import requests
Expand Down Expand Up @@ -222,7 +221,7 @@ def get_variable(resources):
else:
ncdataset = resources

dims = [key for key in ncdataset.dimensions.keys()]
# dims = [key for key in ncdataset.dimensions.keys()]
vars = [key for key in ncdataset.variables.keys()]

# assume that main variables are 3D or 4D
Expand Down
11 changes: 6 additions & 5 deletions eggshell/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,12 @@ def download(url, cache=False):
filename = os.path.join(paths.cache, parsed_url.netloc, parsed_url.path.strip('/'))
if os.path.exists(filename):
LOGGER.info('file already in cache: %s', os.path.basename(filename))
if check_creationtime(filename, url):
msg = 'file in cache older than archive file, downloading: {}'.format(os.path.basename(filename))
LOGGER.info(msg)
os.remove(filename)
filename = download_file(url, out=filename)
# if check_creationtime(filename, url):
# msg = 'file in cache older than archive file, downloading: {}'.format(os.path.basename(filename))
# LOGGER.info(msg)
# os.remove(filename)
# filename = download_file(url, out=filename)
# TODO: enable creation time check
else:
if not os.path.exists(os.path.dirname(filename)):
os.makedirs(os.path.dirname(filename))
Expand Down
14 changes: 7 additions & 7 deletions standalones/ocgis_freememory.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
ncs = [join(p, nc) for nc in listdir(p) if ".nc" in nc]
ncs.sort()

#ncs = datafetch.reanalyses(start=2000, end=2003)
# ncs = datafetch.reanalyses(start=2000, end=2003)

# TODO: BUG: ocg compute is not running if calc == None
# calc = '%s=%s*1' % (variable, variable)
Expand Down Expand Up @@ -83,10 +83,10 @@
########################
# simulation if memory is not enough for the dataload. Than calculate in chunks

fm_sim = data_mb / 2

if data_mb >= fm_sim:
print("NOT enough memory. data will be processed in chunks")
# calculate tile dimension:
tile_dimension = 10
# fm_sim = data_mb / 2
#
# if data_mb >= fm_sim:
# print("NOT enough memory. data will be processed in chunks")
# # calculate tile dimension:
# tile_dimension = 10
# TODO: needs to be calculated based on dataload and available memory
2 changes: 1 addition & 1 deletion tests/test_nc_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from .common import TESTDATA

from eggshell.utils import local_path
from eggshell.nc import utils
from eggshell.nc import nc_utils


def test_get_frequency():
Expand Down

0 comments on commit e989ab3

Please sign in to comment.