Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrapper for grdimage #124

Closed
k-a-mendoza opened this issue Jan 19, 2018 · 6 comments
Closed

Wrapper for grdimage #124

k-a-mendoza opened this issue Jan 19, 2018 · 6 comments
Labels
feature request New feature wanted good first issue Good for newcomers help wanted Helping hands are appreciated

Comments

@k-a-mendoza
Copy link

k-a-mendoza commented Jan 19, 2018

Hey everyone. I'm trying to overlay/add terrain detail on a map, and not having much bash, C, jupyter notebook, or c family language experience, attempting to add a hillshade map has been difficult.

I've got a fair bit of experience with python projects collaboration and OOP stuff, and Id be willing to help implement this feature, but of course the C side stuff is very foreign to me.

@leouieda
Copy link
Member

leouieda commented Feb 7, 2018

Hi @El-minadero, thanks for writing and offering to help! Sorry for the late reply.

There is still a piece of infrastructure missing from LibGMT to make the grd modules work: passing netCDF style grids to GMT throught the virtual file machinery. This isn't a huge a problem and I'm hopping to have it done within the next 2 weeks. I just haven't had time to implement it yet.

Once that is done, we can work on wrapping the grdimage module and I'd love help with that. It will probably look very similar to something like the wrapper for plot: https://github.com/GenericMappingTools/gmt-python/blob/master/gmt/base_plotting.py#L195

Since GMT uses netCDF grids, I'm thinking of having xarray.Dataset as our "official" grid format. We can't use plain numpy arrays most of the time because there are no coordinates attached (and we need those). It would also make it easy to load netCDF data and pass it directly to fig.grdimage, for example.

The hillshading in GMT6 is a lot easier. You can get a hillshaded map with a single option (-I).

I'll ping back here when I have the xarray support working and we can discuss adding grdimage if you're still up for it.

@leouieda leouieda added the feature request New feature wanted label Feb 12, 2018
@adamnicholasprice
Copy link

adamnicholasprice commented Mar 7, 2018

I second this feature request! Actually, just more support for the whole grd[cmd] interface!

@leouieda
Copy link
Member

leouieda commented Mar 7, 2018

@adamnicholasprice thanks for the feedback! I'll update this issue when the required infrastructure is in place.

leouieda added a commit that referenced this issue Apr 10, 2018
Implements a new context manager `LibGMT.grid_to_vfile` that takes
an `xarray.DataArray`, creates a `GMT_MATRIX` to store the data,
passes it along to a virtual file, and yields the virtual file name.

This is the main building block for supporting the `grd*` commands (#124).
@leouieda
Copy link
Member

leouieda commented Apr 10, 2018

Quick update on this issue, now that #159 is merged we can start wrapping the grid plotting modules.

@El-minadero if you want to take a stab at wrapping grdimage let me know. Look at the docs for LibGMT.grid_to_vfile for an example of how to pass in the grid object to a GMT module.

@leouieda leouieda added help wanted Helping hands are appreciated good first issue Good for newcomers labels Apr 10, 2018
@leouieda leouieda changed the title More Pythonic support for grdimage Wrapper for grdimage Apr 24, 2018
leouieda added a commit that referenced this issue Jun 3, 2018
Enable grdimage for file input. Passing in `xarray.DataArray` isn't working
because of some bugs in the GMT C API. This will require some work
on the GMT side before we can use it. 
Implement basic support for grdinfo as well for testing.

Starts to implement #124
@seisman
Copy link
Member

seisman commented Jun 20, 2018

@El-minadero @adamnicholasprice @leouieda I'd like to help implement it if no one is working on this issue.

@leouieda
Copy link
Member

@seisman I'm working out some kinks still on the API to get this working. We found a few bugs in GMT related to grids because this part of the API was never exercised. I'm hoping to have it done tomorrow.

leouieda added a commit that referenced this issue Jun 25, 2018
Implements support for `xarray.DataArray` grids in `Figure.grdimage`.
Not much changed here but this required a lot of changes to the
GMT API itself.
Lacking a bit in documentation but I'm working on a refactor of the
library which will make these things easier.

Fixes #124
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature wanted good first issue Good for newcomers help wanted Helping hands are appreciated
Projects
None yet
Development

No branches or pull requests

4 participants