-
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 load_earth_mask function for GSHHG Global Earth Mask dataset #2310
Conversation
Co-authored-by: Dongdong Tian <seisman.info@gmail.com> Co-authored-by: Michael Grund <23025878+michaelgrund@users.noreply.github.com>
/format |
- 2: Lake | ||
- 3: Island | ||
- 4: Pond | ||
""" |
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 function now returns a dataarray like below:
<xarray.DataArray 'z' (lat: 181, lon: 361)>
array([[1., 1., 1., ..., 1., 1., 1.],
[1., 1., 1., ..., 1., 1., 1.],
[1., 1., 1., ..., 1., 1., 1.],
...,
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.]], dtype=float32)
Coordinates:
* lon (lon) float64 -180.0 -179.0 -178.0 -177.0 ... 178.0 179.0 180.0
* lat (lat) float64 -90.0 -89.0 -88.0 -87.0 -86.0 ... 87.0 88.0 89.0 90.0
Attributes:
long_name: z
actual_range: [0. 2.]
The data dtype is float32, but the original grid @earth_mask_01d_g
contains int8 values. Ideally, the function should return a grid with integer values.
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.
How would I change the value types across the entire array?
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.
How would I change the value types across the entire array?
I don't know. Need to read the xarray docs.
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.
Likely we need to use xarray.DataArray.astype to convert the data from float32
to int8
, i.e., return grid.astype("int8")
.
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
It looks like the number of |
This sounds good to me. |
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
Add
load_earth_mask
to load the remote GSHHG Global Earth Mask dataset.Addresses: #1786
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