fatiando / harmonica

Forward modeling, inversion, and processing gravity and magnetic data
https://www.fatiando.org/harmonica
BSD 3-Clause "New" or "Revised" License
218 stars 70 forks source link

GXF Reader Implementation #538

Open ThomasMGeo opened 3 weeks ago

ThomasMGeo commented 3 weeks ago

Description of the desired feature:

GXF is another Geosoft (now seequent) ASCII file format. It is found sometimes with USGS data releases like here. There is also this gist that I have found.

Are you willing to help implement and maintain this feature? Yes! I currently have functions that work for my needs, but I think this is complimentary to the grd file reader, and should be included in Harmonica. I am happy to do a PR, or help as needed.

One design thing I am concerned about is going from a GXF directly to xarray. I had to mess with the specific examples I had by hand to 'get it right' and wondering if that is best left to the user?

ThomasMGeo commented 3 weeks ago

Here is my gist with code.

ThomasMGeo commented 3 weeks ago

@RichardScottOZ do you have a python GXF reader hiding somewhere?

leouieda commented 3 weeks ago

@ThomasMGeo seems like a great thing to have in Harmonica! I don’t think I understand your reservation with going to xarray. From your gist, it seems like it would be easy to make the metadata CF-compliant and add it to a DataArray or Dataset. The main advantage is that everything else in Harmonica works with xarray and saving to another format like netCDF or Zarr is also trivial.

A PR would be very welcome! Even if just to get things started.

ThomasMGeo commented 3 weeks ago

I will make it a data array in the PR, to just get it going. Thanks!

leouieda commented 3 weeks ago

Would you be able to generate a small grid in that format so we can use for unit testing? It would have to be small so we can store it directly in the repository (like <1Mb).

RichardScottOZ commented 3 weeks ago

@RichardScottOZ do you have a python GXF reader hiding somewhere?

No, sorry! Need a GDB reader though. Bound to have a few of the above in the archives I imagine.