WeatherGod / Watershed

Python implementation of a varient of Watershed clustering
3 stars 4 forks source link

Question concerning input #1

Open kirknorth opened 10 years ago

kirknorth commented 10 years ago

Hi @WeatherGod, I was looking on GitHub to see if anyone had implemented Lakshmanan's extended watershed algorithm and I came across your repo. I'm looking to track some geophysical data (e.g., radar reflectivity), but I'm a little uncertain of how to best input this field into your Watershed_Transform routine. I think a simple example will help in answering my question. Let's say I have reflectivity data as a ndarray (dtype = float64) on a uniform grid which is 201 x 201 grid points in x and y. How should I go about getting this array ready for ingest into your routine? I see you were testing it with a satellite image in PNG format, but I've yet to figure out if PIL can help me here or not.

WeatherGod commented 10 years ago

You don't need PIL. Just input the numpy array of reflectivities, and the max depth and saliancy paramters into the the Watershed_Transform() function, and it should work (admittedly, it has been three years since I have even looked at this code). If memory serves me right there are two things you can do to improve processing time. 1) quantize your image. 2) If you can preselect the basin starting points, you can eliminate the first step of Watershed_Transform().

At some point, I need to rewrite this... but I haven't the time for the next few months. I would be more than happy to accept any patches, though!