-
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
Add pygmt.read to read a dataset/grid/image into pandas.DataFrame/xarray.DataArray #3673
base: main
Are you sure you want to change the base?
Conversation
cac7d74
to
c50232e
Compare
raise ValueError(msg) | ||
|
||
kwdict = { | ||
"R": "/".join(f"{v}" for v in region) if is_nonstr_iter(region) else region, # type: ignore[union-attr] |
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.
This line is used here to avoid using the kwargs_to_string
, use_alias
decorators:
"R": "/".join(f"{v}" for v in region) if is_nonstr_iter(region) else region
In the pygmt/pygmt/datasets/load_remote_dataset.py Lines 444 to 459 in 7768e93
|
Now, the
|
A list of column names. | ||
header | ||
Row number containing column names. ``header=None`` means not to parse the | ||
column names from table header. Ignored if the row number is larger than the |
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.
column names from table header. Ignored if the row number is larger than the | |
column names from the table header. Ignored if the row number is larger than the |
header | ||
Row number containing column names. ``header=None`` means not to parse the | ||
column names from table header. Ignored if the row number is larger than the | ||
number of headers in the table. |
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.
number of headers in the table. | |
number of header lines in the table. |
Description of proposed changes
This PR adds the
pygmt.read
function to read any recognized data files (currently dataset, grid, or image) into a pandas.DataFrame/xarray.DataArray object.The new
read
function can replace mostload_dataarray
/xr.open_dataarray
/xr.load_dataarray
calls.Related to #3643 (comment).
Preview: https://pygmt-dev--3673.org.readthedocs.build/en/3673/api/generated/pygmt.read.html
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 command is:
/format
: automatically format and lint the code