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 blockmedian #348

Closed
weiji14 opened this issue Oct 20, 2019 · 0 comments · Fixed by #349
Closed

Wrapper for blockmedian #348

weiji14 opened this issue Oct 20, 2019 · 0 comments · Fixed by #349
Labels
feature request New feature wanted
Milestone

Comments

@weiji14
Copy link
Member

weiji14 commented Oct 20, 2019

Description of the desired feature

Implement blockmedian that 'Block averages (x,y,z) data tables by L1 norm". This is a data filtering function that I've used in my work before, and one I'd like to incorporate into the upcoming PyGMT FOSS4G workshop #317 (if things move quickly enough!).

The implementation will follow in the footsteps of the surface function #243, using the same @tut_ship.xyz example dataset for the unit tests. I'm looking to implement blockmedian under a new file called filtering.py which will eventually hold other GMT filtering functions like blockmean and blockmode.

Currently I'm facing a problem with deciding how to handle the inputs/outputs. There are various combinations, and I'm thinking of using a 'what you put in is what you get out' strategy, I.e. :

Output\Input file pandas table numpy array* x, y, z triples**
file x
pandas table x
numpy array x
x, y, z triples x

* numpy array could also be a python list of list
** could also be x, y, z, w quadruplets

A tempting alternative is to only provide a pandas.DataFrame table as an output, and if a pandas.DataFrame was provided as input, we make sure to copy the column names to the output table as well. This closely follows the grdtrack example at #308.

Thoughts?

Are you willing to help implement and maintain this feature? Yes

@weiji14 weiji14 added the feature request New feature wanted label Oct 20, 2019
@weiji14 weiji14 added this to the 0.1.0 milestone Oct 20, 2019
weiji14 referenced this issue in weiji14/pygmt Oct 20, 2019
Initial commit for wrapping the blockmedian function for #348, to be implemented under filtering.py. Original GMT `blockmedian` documentation can be found at https://docs.generic-mapping-tools.org/latest/blockmedian.html.

Storing sample test cases under test_blockmedian.py. Current implementation only allows for pandas.DataFrame or ASCII file name inputs, and correspondingly outputs the same type. Tests currently use the load_sample_bathymetry dataset, and we check for a variety of cases that the blockmedian filtered output is valid. Also aliased required arguments spacing (I) and region (R).
@weiji14 weiji14 mentioned this issue Oct 20, 2019
5 tasks
weiji14 referenced this issue in weiji14/pygmt Oct 25, 2019
Initial commit for wrapping the blockmedian function for #348, to be implemented under filtering.py. Original GMT `blockmedian` documentation can be found at https://docs.generic-mapping-tools.org/latest/blockmedian.html.

Storing sample test cases under test_blockmedian.py. Current implementation only allows for pandas.DataFrame or ASCII file name inputs, and correspondingly outputs the same type. Tests currently use the load_sample_bathymetry dataset, and we check for a variety of cases that the blockmedian filtered output is valid. Also aliased required arguments spacing (I) and region (R).
weiji14 referenced this issue in weiji14/pygmt Nov 1, 2019
Initial commit for wrapping the blockmedian function for #348, to be implemented under filtering.py. Original GMT `blockmedian` documentation can be found at https://docs.generic-mapping-tools.org/latest/blockmedian.html.

Storing sample test cases under test_blockmedian.py. Current implementation only allows for pandas.DataFrame or ASCII file name inputs, and correspondingly outputs the same type. Tests currently use the load_sample_bathymetry dataset, and we check for a variety of cases that the blockmedian filtered output is valid. Also aliased required arguments spacing (I) and region (R).
weiji14 referenced this issue in weiji14/pygmt Nov 7, 2019
Initial commit for wrapping the blockmedian function for #348, to be implemented under filtering.py. Original GMT `blockmedian` documentation can be found at https://docs.generic-mapping-tools.org/latest/blockmedian.html.

Storing sample test cases under test_blockmedian.py. Current implementation only allows for pandas.DataFrame or ASCII file name inputs, and correspondingly outputs the same type. Tests currently use the load_sample_bathymetry dataset, and we check for a variety of cases that the blockmedian filtered output is valid. Also aliased required arguments spacing (I) and region (R).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature wanted
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant