HealPix / Healpy: Creat healpix map from (MODIS) satellite data - healpy

I’m planing to map satellite data from MODIS onto a sphere and I thought Healpix could be the right way to do it. However, I don't know how to go about it:
Does the input map need to be in FITS format or could I read an HDF4 MODIS data file into an array (with python) and then use healpy to map it onto a sphere?
I came across this answer: https://stackoverflow.com/a/50495134/7157742 and hoped that something similar would be possible in my case. Any suggestions?

Yes, you can use a standard numpy array.
You need to map your data into the right HEALPix pixel.
To do so you can get arrays of colatitude theta and longitude phi of your data and then find to which pixel they map to using hp.ang2pix.
Then you can create a 1D array healpy map and work with it.
See an example Jupyter Notebook https://gist.github.com/zonca/680c68c3d60697eb0cb669cf1b41c324

Related

Creating a fence diagram in Mayavi or Matplotlib

working with Matplotlib I have produced some resistivity cross sections of the soil, obtaining pictures like this:
Now I would like to display all those sections in 3D so as to visualise better the spatial distribution of resistivity in the field (i.e. a so-called fence diagram). I would also like to plot the 2D map of the site where those measurements were carried out at the base of my plot (say on the XY plane).
As far as I have seen this is not feasible (or at least not convenient) with Matplotlib in 3D hence I decided to switch to Mayavi.
My questions are:
is it feasible georeferenced rasters and then properly place them on the correct (vertical) planes (not necessarily parallel to the cartesian ones) with Mayavi? Does imshow() serves this purpose?
is it better to recreate the contours in Mayavi at the proper locations? If this is the case I did not find a function to create contours from unstructured data (the input images were created with tricontour/tricontourf in Matplotlib). I do not think interpolating over a structured grid in scipy would do, given the non convex domain.
Ok, answering my own question:
mesh = mlab.triangular_mesh
surf = mlab.pipeline.surface(mesh)
seems to do the job.
To be consistent with the previous work, the triangulation, duly masked, can be directly imported from Matplotlib.

Golang simplifying polyline data

I am pulling huge geojson datasets with golang, and I am wondering if there is anything like simplify.js for golang, that would reduce the number of points in a polyline while retaining its shape?
https://mourner.github.io/simplify-js/
There is a Go port of simplify-js
https://github.com/yrsh/simplify-go

Reading data from colour terrain map

I have a question about converting a height-map that is in colour into a matrix - look here to see examples of such maps. If I were to have a terrain plot and plot it using imagesc, then I would see it as a colour map. I was wondering how I could convert an image that looks like this into its corresponding matrix.
This seems like it should be a pretty basic procedure, but I can neither work out how to do it myself nor find out how to do it online (including looking on SO).
To put it another way, the image in question is a jpeg; what I'd like is to be able to convert the .jpg file into a matrix, M say, so that imagesc(M), or surf(M), with the camera looking at the (x,y)-plane (from above), give the same as viewing the image, eg imshow(imread('Picture.jpg')).
You can use Matlab's rbg2ind function for this. All you need to choose is the "resolution" of the output colormap that you want, i.e. the second parameter n. So if you specify n as 8 for example, then your colormap will only have 8 values and your output indexed image should only have 8 values as well.
Depending on the color coding scheme used, you might try first converting the RGB values to HSL or HSV and using the hue values for the terrain heights.

Generating a multipoint topojson file

I am trying to create a map layer using D3 and leaflet for displaying a large number of unique GPS data points. I created it using geoJSON and Leaflet but the performance was poor. I finally got Topojson installed and working, but I cannot get it to produce a Multipoint geometry, only Point geometry which does not shrink the file much. I have passed in a CSV with all the points and used to geoJson file but only get 70,000 point geometries instead of one Multipoint. What am I missing? Do I need to write the Topojson myself? Want to avoid this if possible.
TopoJSON won't help you in this case. To quote the website:
Rather than representing geometries discretely, geometries in TopoJSON files are stitched together from shared line segments called arcs.
As you have no line segments, there's no point in using TopoJSON -- it won't reduce the size of the file.
+1 What Lars said. Your best bet is probably to load the point data as a CSV using d3.csv()instead of a GeoJSON or TopoJSON, as it is much more compact. You can then loop over the data, adding each point to a layer group.
That said, 70,000 is a lot and your map is still probably going to be very slow. You might want to think about using something like PostGIS (or CartoDB for that matter) and request only those points that are visible in a given map state.

Plotting dots to a map given latitude and longitude

Summary: I need a tool that can put 60m+ points on a map image. I'm trying to show density map and would like to plot a dot for each point (lat/long) on the map.
Hi I'm working on project that requires a density map. I have latitude and longitude and all the tools that I have seen (Ammap, FusionCharts maps, google charts/map) requires either XML or JSON or some other data type with the data points. Problem here is that, I have 60 million + data points and transferring any type of object with that many data point is not feasible.
One solution I can think of is mapping latitude and longitude to pixels of the map image. That requires a lot of time and work. I was wondering if you guys have done something similar and know of tools that can do this for me. It doesn't have to be free.
You'd be much better off creating a heatmap instead of passing all of the individual points to the map, which would get very busy, very quickly.
There are already a few discussions over at GIS.StackExchange about this exact topic. Search the the [heatmap] tag.
Since you mentioned FusionCharts, assuming you can load all of your data into a Google Fusion Table, it looks like you should be able to make a heat map in Google Fusion Tables).

Resources