Comments (5)
Hi @Rockhound-NC
I use a 2015 Macbook Pro (8 GB ram) for most of my development and day-to-day testing.
A 36M-length numpy array should be 144 MB (if int32) and 288 MB (if int64). You could save some space by restricting it to unsigned int, but that shouldn't be the problem here.
I'll have to check and see if the behavior of some of the dependencies has changed. Otherwise, I can't see a reason why you'd be getting a memory error 🤔
Have you tried creating a 36M length numpy array outside of pysheds? (e.g. a = np.arange(36000000)
)
Thanks,
MDB
from pysheds.
Thanks for the reply Matt. Some very interesting behavior on my end. I am a bit of a newb, so forgive me if this isn't the right forum for this question. Here is some commented code to help explain what I am seeing:
# import required modules
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.colors as colors
from pysheds.grid import Grid
import seaborn as sns
#import warnings
#warnings.filterwarnings('ignore')
# Set env variables and directories
workingDir='D:/_projects/pysheds'
# Assign variables
grid = Grid.from_raster(workingDir + '/_data/n30w100_con', data_name='dem')
# following lines runs
aTest=np.arange(36000000)
# following line runs
bTest = np.arange(grid.size)
# following line fails due to memory error.
grid.resolve_flats('dem', out_name='inflated_dem')
# Now, the command from a few lines ago also fails due to memory error
aTest = np.arange(36000000)
It seems that maybe something in the execution of any function from grid.py that employs the _inside_indices
subroutine is bogging up my memory. Any help appreciated!
from pysheds.
Are you using the 32-bit version of python? I would recommend using the 64-bit version (not just for this library, but in general). See: https://www.quora.com/What-are-the-advantages-of-64-bit-Python-over-32-bit-Python
Aside from that, I can't think of any issues that would be causing you to run out of memory. You can also try calling grid._inside_indices
directly and see what happens.
from pysheds.
Alright, fantastic advice there on the 64 bit version. That cleared up the memory issue. Thanks!
I did have to play a bit with skimage to get things to work and figured I'd pass this along. If it jives on your end, may consider an update to the code.
In grid.py
you attempt to import measure and transform from skimage. I believe skimage has been updated to where measure and tranform are now submodules and you must import "from", not dot import.
I replaced your two lines (20 and 21, import skimage.measure
and import skimage.transform
) with the following block of code, recompiled the pyc, and voila.
import skimage
from skimage import measure
from skimage import transform
Very excited about this package, appreciate your time!
from pysheds.
Are you using the development version of skimage? I was able to import using the latest stable version from pypi:
In [1]: import skimage
In [2]: import skimage.transform
In [3]: import skimage.measure
In [4]: skimage.__version__
Out[4]: '0.14.0'
from pysheds.
Related Issues (20)
- How to create Flow Distance raster same shape as DEM raster?
- Re-evaluate Numba performance HOT 2
- Allow Numba to perform polymorphic dispatching HOT 5
- Can't 'imshow' DEM for some unkown reason HOT 1
- extract_profiles function returning wrong connections when neighbouring cells drain to outlet
- strang plots HOT 1
- Allow user to disable `parallel=True` with numba HOT 2
- Why stream network `LineStrings` do not pass through the centroid of each grid cell? HOT 1
- accumulation issue HOT 3
- Preprocessing DEM with pysheds seems to produce incorrect accumulations HOT 11
- Using catchment() with discharge point outside of extents crashes program
- sGrid and pGrid have major differences
- Pysheds Cupy / Cuspatial support HOT 1
- Accumulation disconnections HOT 4
- setup fail by github repo of latest release version
- Pixels that should be accumulation watercourses are shown as nodata HOT 2
- Wrong bbox when using `ViewFinder` HOT 3
- issue in pygrid with np.int and np.warnings
- D8 and Dinf flow directions look incorrect HOT 4
- Indexing Error in _d8_distance_from_ridge
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pysheds.