Skip to content
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 notebook to validate spatial averaging #23

Closed
tomvothecoder opened this issue Oct 19, 2021 · 6 comments
Closed

Add notebook to validate spatial averaging #23

tomvothecoder opened this issue Oct 19, 2021 · 6 comments
Assignees

Comments

@tomvothecoder
Copy link
Collaborator

tomvothecoder commented Oct 19, 2021

Validation Checklist

  1. API usage (and plots where helpful)
  2. Performance metrics (use timeit)
  3. Bugs, improvements
  4. Questions

Compare below APIs against CDAT equivalent.

  • ds.xcdat.spatial_average() or ds.spatial.avg()
@tomvothecoder tomvothecoder changed the title Add notebook for testing spatial averaging Add notebook for spatial averaging validation Oct 20, 2021
@tomvothecoder tomvothecoder changed the title Add notebook for spatial averaging validation Add notebook to validate spatial averaging Oct 20, 2021
@tomvothecoder
Copy link
Collaborator Author

Hi @lee1043, I noticed you already started work on this issue so I assigned you to it. Steve and I can review the PR whenever you're ready to open one.

@lee1043
Copy link
Collaborator

lee1043 commented Oct 21, 2021

Hi @tomvothecoder, yes I started playing with it in this notebook, which eventually can be used for demo. I'd be happy to take lead on that. I will probably write a separate (but similar) notebook that is dedicated for the validation.

I have some questions.

  1. I think I understand that the spatial average should be conducted on dataset (as in cell [19] of the notebook), not data array (which I hoped for doing such as in cell [17] and [18] of the notebook). I was hopping for the later case because the data array is a generated one (land masking applied to the given data array of the dataset). Maybe a workaround to be define a new dataset by using the new data array, then apply spatial average to the new dataset?

  2. I think cdms assigns weighting for spatial average as a default while xcdat does not. Should we consider providing default weightings in xcdat for spatial averaging?

@pochedls
Copy link
Collaborator

pochedls commented Oct 21, 2021

  1. I think I understand that the spatial average should be conducted on dataset (as in cell [19] of the notebook), not data array (which I hoped for doing such as in cell [17] and [18] of the notebook). I was hopping for the later case because the data array is a generated one (land masking applied to the given data array of the dataset). Maybe a workaround to be define a new dataset by using the new data array, then apply spatial average to the new dataset?

Yes - you can create a new masked dataset and then call the spatial averager.

  1. I think cdms assigns weighting for spatial average as a default while xcdat does not. Should we consider providing default weightings in xcdat for spatial averaging?

xcdat - weights data (by area) by default [Note - I now see the confusion; if you do not pass in a weighting matrix (i.e., default None), then it will calculate the spatial weights for you].

@tomvothecoder
Copy link
Collaborator Author

tomvothecoder commented Nov 10, 2021

I think cdms assigns weighting for spatial average as a default while xcdat does not. Should we consider providing default weightings in xcdat for spatial averaging?

xcdat - weights data (by area) by default [Note - I now see the confusion; if you do not pass in a weighting matrix (i.e., default None), then it will calculate the spatial weights for you].

To avoid confusion, we can either rename the method param from weights to custom_weights (or some other clearer name), or set the default value to weights="generate" instead of None.

I'm lean towards custom_weights=None because it is clearer that the weights are user-specified (with a tradeoff in verbosity). I'm open to other opinions though.

@tomvothecoder
Copy link
Collaborator Author

To avoid confusion, we can either rename the method param from weights to custom_weights (or some other clearer name), or set the default value to weights="generate" instead of None.

Issue opened to address this: xCDAT/xcdat#147

@tomvothecoder
Copy link
Collaborator Author

This issue is from almost 3 years ago and does not need to be addressed anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants