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

blockmedian fails with x,y,z options and not table. #1351

Closed
leonfoks opened this issue Jun 23, 2021 · 3 comments
Closed

blockmedian fails with x,y,z options and not table. #1351

leonfoks opened this issue Jun 23, 2021 · 3 comments
Labels
wontfix This will not be worked on

Comments

@leonfoks
Copy link

Description of the problem
Im trying to use block median before surface and I want to specify x, y, z instead of casting into a dataframe or other format.
I'm looking at the docs here which state this is possible.

It would be good to have examples in the documentation for the block filtering and surface methods (as a side note :) )
Thanks in advance for your help!

Full code that generated the error

import numpy as np
from pygmt import blockmedian
x = np.random.randn(10000)
y = np.random.randn(10000)
z = np.random.randn(10000)

pd = blockmedian(x=x, y=y, z=z, I=(0.1, 0.1), R=[-4, 4])

Full error message

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<path>/pygmt/helpers/decorators.py", line 288, in new_module
    return module_func(*args, **kwargs)
  File "<path>/pygmt/helpers/decorators.py", line 432, in new_module
    return module_func(*args, **kwargs)
TypeError: blockmedian() missing 1 required positional argument: 'table'

System information

Please paste the output of python -c "import pygmt; pygmt.show_versions()":

PyGMT information:
  version: v0.3.1
System information:
  python: 3.8.10 | packaged by conda-forge | (default, May 11 2021, 06:39:48)  [Clang 11.1.0 ]
  executable: <path>/bin/python
  machine: macOS-10.14.6-x86_64-i386-64bit
Dependency information:
  numpy: 1.20.3
  pandas: 1.2.4
  xarray: 0.18.2
  netCDF4: 1.5.6
  packaging: 20.9
  ghostscript: 9.54.0
  gmt: 6.1.1
GMT library information:
  binary dir: <path>/bin
  cores: 8
  grid layout: rows
  library path: <path>/lib/libgmt.dylib
  padding: 2
  plugin dir: <path>/lib/gmt/plugins
  share dir: <path>/share/gmt
  version: 6.1.1
@leonfoks leonfoks added the bug Something isn't working label Jun 23, 2021
@weiji14
Copy link
Member

weiji14 commented Jun 23, 2021

Hi @leonfoks, the xyz input into pygmt.blockmedian is a feature available in PyGMT v0.4.0 (done in #1319), but it appears that you have PyGMT v0.3.1 installed. Could you try upgrading and see if it works?

It would be good to have examples in the documentation for the block filtering and surface methods (as a side note :) ) Thanks in advance for your help!

And yes, agree that we should have some examples for those methods. Would you prefer a full tutorial or just a gallery example? I did make a blockmedian/surface example a while ago at a workshop (see https://github.com/GenericMappingTools/foss4g2019oceania/blob/v1/3_lidar_to_surface.ipynb) but definitely should have it in the PyGMT docs somewhere for better visibility.

@leonfoks
Copy link
Author

Hi @weiji14 , Another easy one from me. Thanks for the quick response. I updated and it's working just fine!

Personally, I think a gallery example would suffice. Perhaps containing a surface example, then a surface example that produces the block median warning message and finally use of the block median to reduce and then use surface, showing that the images look visually the same before and after reduction.
Great link to the lidar example, I would parse that down a little for the gallery but the data would be a good set.

Thanks again!

@seisman seisman added wontfix This will not be worked on and removed bug Something isn't working labels Jun 23, 2021
@weiji14
Copy link
Member

weiji14 commented Jun 23, 2021

Hi @weiji14 , Another easy one from me. Thanks for the quick response. I updated and it's working just fine!

No worries :)

Personally, I think a gallery example would suffice. Perhaps containing a surface example, then a surface example that produces the block median warning message and finally use of the block median to reduce and then use surface, showing that the images look visually the same before and after reduction.
Great link to the lidar example, I would parse that down a little for the gallery but the data would be a good set.

Ok, I'll open a separate issue for this documentation suggestion, and maybe someone will work on it for the upcoming SciPy sprint in July.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants