fastscape-lem / fastscapelib

A C++/Python library of efficient algorithms for landscape evolution modeling
http://fastscapelib.readthedocs.io
GNU General Public License v3.0
36 stars 6 forks source link

Global lat-lon grids #135

Open benbovy opened 1 year ago

benbovy commented 1 year ago

Currently Fastscapelib only provides two kinds of 2-d cartesian grids but those are not ideal for global (Earth or planetary) simulations. We could provide two additional grid (sub)classes for dealing with spherical coordinates: global_raster_grid global_trimesh, which would inherit directly from raster_grid and trimesh respectively. I think all it would need is each a specialized implementation for neighbors_distances_impl and nodes_areas_impl. Distances can be computed using the Haversine formula. Areas might be a little more complex to compute but maybe we could use an approximation (flat facets).

While it could be convenient, I'm not sure that a global_raster_grid with uniform spacing in latitude / longitude would be very useful for landscape evolution modeling, though. It would also need some additional validation checks or logic for boundary conditions (looped by default on the longitude) and for dealing with high-latitudes (poles), e.g., allow abs(latitude) < 90 degrees and add two pole nodes connected to all max(abs(latitude)) grid nodes.

cc @hannahsophiadavies

benbovy commented 1 year ago

Alternatively to subclasses, we could reuse the same classes with specialized factories (e.g., trimesh::from_latlon()).

Pros:

Cons: