-
Notifications
You must be signed in to change notification settings - Fork 30
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
UxDataArray.inverse_distance_weighted_remap returns UxDataset #776
Comments
Hi @ahijevyc Can you try running the following? var.inverse_distance_weighted_remap(destination_obj=var.uxgrid).plot.polygon() This should return a When you pass through the Let me know if this works! |
I do now get a UxDataArray from
var.inverse_distance_weighted_remap(destination_obj=var.uxgrid)
However, the plot.polygon() trips up with an error:
/glade/work/ahijevyc/conda-envs/uxarray/lib/python3.11/site-packages/uxarray/remap/inverse_distance_weighted.py:190:
UserWarning: Your data is stored on n_face, but you are remapping to
nodes
warnings.warn(
…---------------------------------------------------------------------------AttributeError
Traceback (most recent call last)
Cell In[10], line 12 10 # UxDataArray from UxDataset 11 var =
uxds["landmask"]---> 12
var.inverse_distance_weighted_remap(destination_obj=var.uxgrid).plot.polygon()
13 # returns UxDataset, not UxDataArray
File /glade/work/ahijevyc/conda-envs/uxarray/lib/python3.11/site-packages/uxarray/plot/accessor.py:286,
in UxDataArrayPlotAccessor.__getattr__(self, name) 284 return
getattr(xarray_plot_accessor, name) 285 else:--> 286 raise
AttributeError(f"Unsupported Plotting Method: '{name}'")
AttributeError: Unsupported Plotting Method: 'polygon'
On Mon, May 6, 2024 at 2:31 PM Philip Chmielowiec ***@***.***> wrote:
Hi @ahijevyc <https://github.com/ahijevyc>
Can you try running the following?
var.inverse_distance_weighted_remap(destination_obj=var.uxgrid).plot.polygon()
This should return a UxDataArray
When you pass through the UxDataArray as the destination_obj, we are
attempting to store both the remapped and original variable together in a
single dataset. Doing it the above way always will return a new
UxDataArray
Let me know if this works!
—
Reply to this email directly, view it on GitHub
<#776 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AEIPI2APBJNR2WWMC3CE3W3ZA7SBLAVCNFSM6AAAAABHJI4FEOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOJWHA2TGOJQGA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
You want to set var.inverse_distance_weighted_remap(destination_obj=var.uxgrid, remap_to='face centers').plot.polygon() |
I added that, but still got the same error:
…---> 12 var.inverse_distance_weighted_remap(destination_obj=var.uxgrid,
remap_to="face centers").plot.polygon() 13 # returns UxDataset,
not UxDataArray
File /glade/work/ahijevyc/conda-envs/uxarray/lib/python3.11/site-packages/uxarray/plot/accessor.py:286,
in UxDataArrayPlotAccessor.__getattr__(self, name) 284 return
getattr(xarray_plot_accessor, name) 285 else:--> 286 raise
AttributeError(f"Unsupported Plotting Method: '{name}'")
AttributeError: Unsupported Plotting Method: 'polygon'
On Mon, May 6, 2024 at 3:40 PM Philip Chmielowiec ***@***.***> wrote:
You want to set remap_to='face centers' to have the result stored on each
face.
https://github.com/UXARRAY/uxarray/blob/e240f7a3d9cb89e1ef201bd11df61279ca893a9d/uxarray/remap/dataarray_accessor.py#L52-L80
—
Reply to this email directly, view it on GitHub
<#776 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AEIPI2HOLCBFZBT6E5GIH63ZA72FJAVCNFSM6AAAAABHJI4FEOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOJWHE3TCMBXGQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
It looks like the remapping isn't actually doing anything though. Looking into it further. |
Do you have a workaround for this?
…On Mon, May 6, 2024 at 5:36 PM Philip Chmielowiec ***@***.***> wrote:
It appears that the remapping is functioning normally (new values are
returned in the data array), but the plotting functions are using the
existing value of the data variable (i.e. landmask) and is not plotting
the new one.
I'll get a fix for this out, it's an issue with some of our internal
caching.
—
Reply to this email directly, view it on GitHub
<#776 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AEIPI2DRUV7J7S6DQCZ4CM3ZBAHY3AVCNFSM6AAAAABHJI4FEOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOJXGA4TONJVGM>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Thanks for the follow up. Pinging @aaronzedwick and we can take a look into it this week. |
This is related to what we talked about on Monday when we met, there appear to be issues when running IDW on the same source and destination grid. |
Could it be that when we try and remap the variable to the same dataset, it is using the same exact variable name, so there is an error because it already exists and thus tries to overwrite it, at the same time as it is being read from? |
Version
2024.04.0
How did you install UXarray?
Conda
What happened?
When I used plot.rasterize or plot.polygon on a UxDataArray, I got an error
AttributeError: Unsupported Plotting Method: 'polygon'
What did you expect to happen?
Does UxDataArray.inverse_distance_weighted_remap have to return a UxDataset? I was wondering if it could return a UxDataArray, given a UxDataArray to begin with.
I noticed the change to UxDataset when trying to plot a smoothed UxDataArray. See code below.
Can you provide a MCVE to repoduce the bug?
The text was updated successfully, but these errors were encountered: