Hacker News new | ask | show | jobs
by 4thaccount 2625 days ago
Neat...I just wish there was an easy way to give the basemap library a 3-item tuple with (lat, lon, value) and have it automatically do a heat map and not just plot the points. That is an option in some software.
3 comments

I have something of the sort. Give it later, lon and a value, it performs cubic interpolation and forms a heatmap. Some of the code is specific to my application but I'm sure you can reuse.

https://github.com/rraks/sigcatch

Open to contributions.

Thank you! I'll look.
basemap (like matplotlib) has the contourf method. You can calculate your x, y, and z values using matplotlib.mlab.griddata (altho scipy's are faster), and pass the results to it:

https://stackoverflow.com/a/26885815/416626

Thanks for the link
Related: basemap is deprecated, use cartopy instead! https://scitools.org.uk/cartopy/docs/latest/
cartopy's website assumes that I know what I am doing.

There is no good entrypoint into the documentation, it just starts to tell me about projection details. The documentation outline is a list of the code functions with no clear point to start or indication which places might be good to start at.

I also can't find any examples for quick demonstration and trying. (edit: I found them after clicking all the links. Well... it's in the middle of a list of details I'm not interesting in and says 'Using cartopy with matplotlib'. Oh, at the bottom there is a link with more examples which I could find neither in the index nor in the outline... urgh.)

basemap's website also has a lot of problems, but it is a lot easier to use and we are lazy.

I used to just look for something similar in the gallery: https://scitools.org.uk/cartopy/docs/latest/gallery/ but the docs definitely do assume you know about map projections.
The examples definitely improved a lot in the last year. When I first looked at it there were very few and some of them were logos, not maps.

But again, it is not very obvious that the gallery includes sample code, and that you have to click the pictures to get there.

I know about projections, I just don't care enough for that to be the first thing I see. When I start out I just want to make a basic map, fast. (edit: That's actually typical of many open source projects: They start by telling you about all the fancy tech behind it and let you figure out for yourself how to reach your goal/what goal you can actually reach with it.)

Well, enough of whining about the page to probably unrelated people. I actually found it a sign of trustworthyness if a project page looks chaotic and full of bad copy. It means they're not a startup and/or trying to sell something, usually. (This is just too much though, it is not just not new and fancy with no calls to action and pop-ups for mailing lists, it actively tries to hinder you in doing what you came to do.)