Skip to content
This repository was archived by the owner on Nov 9, 2019. It is now read-only.

Commit 232317f

Browse files
committed
Use scikit-image for resizing
1 parent cb0fd1d commit 232317f

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

environment.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ dependencies:
1717
- pytables
1818
- python=3.6
1919
- s3fs
20+
- scikit-image
2021
- scikit-learn
2122
- scipy
2223
- pip:

prep_data.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,16 @@ def weather(growth=3200):
8181
if all(os.path.exists(fn.replace('small', 'big')) for fn in filenames):
8282
return
8383

84-
from scipy.misc import imresize
84+
from skimage.transform import resize
8585
import h5py
8686

8787
for fn in filenames:
8888
with h5py.File(fn, mode='r') as f:
8989
x = f['/t2m'][:]
9090

91-
y = imresize(x, growth)
91+
new_shape = tuple(s * growth // 100 for s in x.shape)
92+
93+
y = resize(x, new_shape, mode='constant')
9294

9395
out_fn = os.path.join('data', 'weather-big', os.path.split(fn)[-1])
9496

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ requests-oauthlib==0.8.0
8484
rsa==3.4.2
8585
s3fs==0.1.4
8686
s3transfer==0.1.13
87+
scikit-image
8788
scikit-learn==0.19.1
8889
scipy==1.0.1
8990
Send2Trash==1.5.0

0 commit comments

Comments
 (0)