Open ahijevyc opened 2 months ago
Hi @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!
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 https://github.com/UXARRAY/uxarray/issues/776#issuecomment-2096853900, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEIPI2APBJNR2WWMC3CE3W3ZA7SBLAVCNFSM6AAAAABHJI4FEOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOJWHA2TGOJQGA . You are receiving this because you were mentioned.Message ID: @.***>
You want to set remap_to='face centers'
to have the result stored on each face.
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.
— Reply to this email directly, view it on GitHub https://github.com/UXARRAY/uxarray/issues/776#issuecomment-2096971074, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEIPI2HOLCBFZBT6E5GIH63ZA72FJAVCNFSM6AAAAABHJI4FEOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOJWHE3TCMBXGQ . You are receiving this because you were mentioned.Message ID: @.***>
I was able to get this generated on Casper.
uxds["landmask"].remap.inverse_distance_weighted(destination_obj=uxds.uxgrid, remap_to='face centers').plot.polygons()
Can you give that a try?
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 https://github.com/UXARRAY/uxarray/issues/776#issuecomment-2097097553, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEIPI2DRUV7J7S6DQCZ4CM3ZBAHY3AVCNFSM6AAAAABHJI4FEOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOJXGA4TONJVGM . You are receiving this because you were mentioned.Message ID: @.***>
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.
@aaronzedwick
I noticed the change to UxDataset when trying to plot a smoothed UxDataArray. See code below.
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.
@aaronzedwick
I noticed the change to UxDataset when trying to plot a smoothed UxDataArray. See code below.
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?