Terraform Planets with the Planetoid API Package in Python
As Data Scientists, we seem to focus much of our attention on models & algorithms, frameworks & techniques… You know, the stuff that makes you think: Damn, that’s cool! How can I use that?!
However, something that I find altogether lacking in the content we are producing is the creative side of things.
Thanks to my background in Geographic Information Science I’ve been fortunate enough to study Cartography
and regularly apply cartographic principles through out much of my professional career.
Something I absolutely love about Cartography, is that it is often described as the art, science and technology of map making.
Let that sink in for a second. When’s the last time you deliberately described something you’re working on as art first, science and technology second?
There’s a lot that goes into map making, and it takes a very discerning eye to translate raw data into something both useful and beautiful. Maps by their very nature are meant for people to look at them so they HAVE to be beautiful.
So I thought, how could I contribute something fun to our community that gives a data scientist the opportunity to have a taste of this as simply as possible?
is a high level Python API for generating interactive, procedurally generated worlds from data in a pandas DataFrame.
It let’s you take your data from this:
MNIST dataset reduced to 2 dimensions using UMAP
Screenshot of an MNIST-derived planetoid
By simply calling .fit_terraform() . See what I did there? 😉
How does it do this?
Currently, Planetoids is able to terraform
a planet from two-dimensional data that has an optional cluster attribute. It’s still very new and will be growing in capabilities, but for now the library can achieve the following when terraforming a new world:
- generates somewhere in space to render your creation
- generates an ecology based on input data statistics (you can also specify an ecology manually)
- generates land masses with topographic detail (contours) & relief detail (gradients)
- generates lighting effects in the form of a hillshade
As a user you have control over the level of detail in your generated Planetoid and can choose what gets rendered in the interactive plot. The full public API is documented here
Under the hood, I’m using plotly
to render the planetoids. At present, the ScatterGeo trace I’m using is not z-aware and can only handle vector data, so I’ve had to come up with interesting ways to give the illusion of 3D-depth in much the same way you would have to for a printed map.
Installation is as easy as pip install planetoids and the project
has been set up with Travis-CI for automated testing and Codacy for automated code reviews & analytics to make it easier for others interested in this project to join and contribute. I’ve tagged some good first issues
for any interested parties out there keen on helping me extend the project. 😁
It’s still in an alpha state, so it’s possible that aspects of the API may change in coming releases as features are added and refined.
There are a handful of interactive demo notebooks
available online to help you get started. I’m super
keen to see what people end up producing with this library and I would encourage anyone to submit demos to include as part of the repository to showcase how this can be used across different domains.
I hope you have as much fun working with it as I have had making it so far. Happy terraforming!
Subscribe to get your daily round-up of top tech stories!