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 8d44d4c commit ba2b0c8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
12 changes: 6 additions & 6 deletions eggshell/nc/calculation.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def fieldmean(resource):
from numpy import radians, average, cos, sqrt, array

data = get_values(resource) # np.squeeze(ds.variables[variable][:])
dim = data.shape
# dim = data.shape
LOGGER.debug(data.shape)

if len(data.shape) == 3:
Expand Down Expand Up @@ -58,7 +58,7 @@ def remove_mean_trend(fana, varname):
if type(fana) == list:
fana = fana[0]

backup_ana = 'orig_mod_'+path.basename(fana)
backup_ana = 'orig_mod_' + path.basename(fana)

cdo = Cdo()

Expand Down Expand Up @@ -87,7 +87,7 @@ def remove_mean_trend(fana, varname):
mean_arcvar = mean_arc_dataset.variables[varname][:]
data = mean_arcvar[:, 0, 0]
mean_arc_dataset.close()
x = np.linspace(0, len(data)-1, len(data))
x = np.linspace(0, len(data) - 1, len(data))
y = data

# Very slow method.
Expand All @@ -110,15 +110,15 @@ def remove_mean_trend(fana, varname):

orig_arcvar[:] = det

at = {k: orig_arcvar.getncattr(k) for k in orig_arcvar.ncattrs()}
# at = {k: orig_arcvar.getncattr(k) for k in orig_arcvar.ncattrs()}
maxat = np.max(det)
minat = np.min(det)
act = np.zeros((2), dtype=np.float32)
valid = np.zeros((2), dtype=np.float32)
act[0] = minat
act[1] = maxat
valid[0] = minat - abs(0.2*minat)
valid[1] = maxat + abs(0.2*maxat)
valid[0] = minat - abs(0.2 * minat)
valid[1] = maxat + abs(0.2 * maxat)
act_attr = {}
val_attr = {}

Expand Down
7 changes: 4 additions & 3 deletions standalones/ocgis_freememory.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
#
# ncs = []
# for year in years:
# url = 'https://www.esrl.noaa.gov/psd/thredds/fileServer/Datasets/ncep.reanalysis.dailyavgs/pressure/slp.%s.nc' % (year)
# url = 'https://www.esrl.noaa.gov/psd/thredds/fileServer/Datasets/ncep.reanalysis.dailyavgs/pressure/slp.%s.nc'
# % (year)
# ncs.extend([utils.download_file(url)])
# # print ncs

Expand Down Expand Up @@ -82,10 +83,10 @@
########################
# simulation if memory is not enough for the dataload. Than calculate in chunks

fm_sim = data_mb/2
fm_sim = data_mb / 2

if data_mb >= fm_sim:
print "NOT enough memory. data will be processed in chunks"
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

0 comments on commit ba2b0c8

Please sign in to comment.