-
Notifications
You must be signed in to change notification settings - Fork 224
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
Use a single function for loading any sample dataset #1685
Conversation
I like the idea of having a single function to call datasets, but I think it may make
|
I agree that separating the parsing code would be more readable. I went with the current implementation anyways because I thought we should issue a deprecation notice if |
My solution would be to just copy and paste the I know it's a little cumbersome, but I think it's better to have some redundant code to set the precedent that |
Sounds good, I updated the code based on your suggestions. |
I think your implementation works better than what I envisioned; I like that the original functions still get a returned value from |
I updated these two functions first to get agreement on the structure before putting a lot of work in. I would lean slightly towards updating the other functions in other PRs to keep the PR size down and allow new additions in the meantime (e.g., MaunaLao_CO2 for #1512), but could update them in this PR (likely after Jan 3) if that's what others prefer. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I went with the current implementation anyways because I thought we should issue a deprecation notice if load_japan_quakes is called by the user, but not if it is called by load_sample_dataframe and could not find any satisfactory solutions for distinguishing between those two cases.
I feel that there should be a way to silence the warning somehow so that we don't need to make new temporary functions. Will look into this in the coming days (I'm currently reviewing this on the plane, haha).
Co-authored-by: Wei Ji <23487320+weiji14@users.noreply.github.com>
OK, I pushed a revised module that avoids using new functions at the expense of being a bit trickier. Rather than removing the original function (e.g., |
Personally, I prefer to have a single function |
Sounds good to me, I updated the name accordingly. I actually realized we do not have any functions yet for loading sample DataArray objects from the GMT cache, but I assume that we will in the future. |
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
return names | ||
|
||
|
||
def load_sample_data(name): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm thinking if we can merge the list_sample_data()
function into load_sample_data()
, so that we don't have to maintain two dictionaries.
For example, calling load_sample_data()
without giving a name can return the name-description dict.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer to keep them separate even though it requires two dictionaries because I think overall it's simpler to have each function have one purpose.
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
This PR is a follow-up of #1685 and updates the syntax for loading sample datasets in all corresponding gallery examples.
This PR is a follow-up of #1685 and updates the syntax for loading sample datasets in all corresponding tutorials.
…ools#1685) Co-authored-by: Wei Ji <23487320+weiji14@users.noreply.github.com> Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
Description of proposed changes
This PR partially implements the suggestions in #1436, in deprecating individual functions in favor of a single function for loading sample datasets.
It also adds a
list_sample_dataframes
function that lists the available dataset names to provide toload_sample_dataframe
.A couple questions:
name="japan_quakes"
vsname="tut_quakes.ngdc"
)?To do:
Reminders
make format
andmake check
to make sure the code follows the style guide.doc/api/index.rst
.Slash Commands
You can write slash commands (
/command
) in the first line of a comment to performspecific operations. Supported slash commands are:
/format
: automatically format and lint the code/test-gmt-dev
: run full tests on the latest GMT development version