-
Notifications
You must be signed in to change notification settings - Fork 121
Change storage precision and data size for parameters to 32bit #11830
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -29,7 +29,7 @@ def get_scaling_factor(nr_observations: int, nr_components: int) -> float: | |||||||||||||
|
|
||||||||||||||
|
|
||||||||||||||
| def get_nr_primary_components( | ||||||||||||||
| responses: npt.NDArray[np.float64], threshold: float | ||||||||||||||
| responses: npt.NDArray[np.float32], threshold: float | ||||||||||||||
| ) -> int: | ||||||||||||||
| """ | ||||||||||||||
| Calculate the number of principal components required | ||||||||||||||
|
|
@@ -61,7 +61,7 @@ def get_nr_primary_components( | |||||||||||||
|
|
||||||||||||||
|
|
||||||||||||||
| def cluster_responses( | ||||||||||||||
| responses: npt.NDArray[np.float64], | ||||||||||||||
| responses: npt.NDArray[np.float32], | ||||||||||||||
| nr_clusters: int, | ||||||||||||||
| ) -> npt.NDArray[np.int_]: | ||||||||||||||
| """ | ||||||||||||||
|
|
@@ -70,7 +70,7 @@ def cluster_responses( | |||||||||||||
| be clustered together. | ||||||||||||||
| """ | ||||||||||||||
| correlation = spearmanr(responses).statistic | ||||||||||||||
| if isinstance(correlation, np.float64): | ||||||||||||||
| if isinstance(correlation, np.floating): | ||||||||||||||
| correlation = np.array([[1, correlation], [correlation, 1]]) | ||||||||||||||
| # Take absolute value to cluster based on correlation strength rather | ||||||||||||||
| # than direction. | ||||||||||||||
|
|
@@ -84,9 +84,9 @@ def cluster_responses( | |||||||||||||
|
|
||||||||||||||
|
|
||||||||||||||
| def main( | ||||||||||||||
| responses: npt.NDArray[np.float64], | ||||||||||||||
| obs_errors: npt.NDArray[np.float64], | ||||||||||||||
| ) -> tuple[npt.NDArray[np.float64], npt.NDArray[np.int_], npt.NDArray[np.int_]]: | ||||||||||||||
| responses: npt.NDArray[np.floating], | ||||||||||||||
| obs_errors: npt.NDArray[np.floating], | ||||||||||||||
| ) -> tuple[npt.NDArray[np.floating], npt.NDArray[np.int_], npt.NDArray[np.int_]]: | ||||||||||||||
|
Comment on lines
+87
to
+89
|
||||||||||||||
| responses: npt.NDArray[np.floating], | |
| obs_errors: npt.NDArray[np.floating], | |
| ) -> tuple[npt.NDArray[np.floating], npt.NDArray[np.int_], npt.NDArray[np.int_]]: | |
| responses: npt.NDArray[np.float32], | |
| obs_errors: npt.NDArray[np.float32], | |
| ) -> tuple[npt.NDArray[np.float32], npt.NDArray[np.int_], npt.NDArray[np.int_]]: |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -529,9 +529,9 @@ def _load_single_dataset( | |||||
| def _load_dataset( | ||||||
| self, | ||||||
| group: str, | ||||||
| realizations: int | np.int64 | npt.NDArray[np.int_], | ||||||
| realizations: int | np.int32 | npt.NDArray[np.int_], | ||||||
| ) -> xr.Dataset: | ||||||
| if isinstance(realizations, int | np.int64): | ||||||
| if isinstance(realizations, int | np.int32): | ||||||
|
||||||
| if isinstance(realizations, int | np.int32): | |
| if isinstance(realizations, int | np.integer): |
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.
should this be np.floating instead? it seems responses can be np.float64 coming from main?
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.
yes, probably it should be
np.floatingI have changed it in some places 😄