-
Notifications
You must be signed in to change notification settings - Fork 299
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 flash age compositor for li instruments #2895
base: main
Are you sure you want to change the base?
Add flash age compositor for li instruments #2895
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2895 +/- ##
========================================
Coverage 96.06% 96.07%
========================================
Files 370 375 +5
Lines 54320 54474 +154
========================================
+ Hits 52185 52335 +150
- Misses 2135 2139 +4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Pull Request Test Coverage Report for Build 10700852657Details
💛 - Coveralls |
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.
Thanks for this first draft! I left a comment regarding the reference time.
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.
I'm really surprised that our pre-commit/linters are not catching the spacing inconsistencies. I've made some comments on small style things, but also on some bigger things that should be changed. Thanks for getting this going.
On a higher-level discussion, shouldn't this kind of functionality be something implemented in the reader?
self.name = name | ||
super().__init__(name, prerequisites, optional_prerequisites, **kwargs) |
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.
self.name = name | |
super().__init__(name, prerequisites, optional_prerequisites, **kwargs) | |
super().__init__(name, prerequisites, optional_prerequisites, **kwargs) |
def _normalize_time(self,data:xr.DataArray,attrs:dict)->xr.DataArray: | ||
"""Normalised the time in the range between [end_time,end_time - time_range]. |
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.
def _normalize_time(self,data:xr.DataArray,attrs:dict)->xr.DataArray: | |
"""Normalised the time in the range between [end_time,end_time - time_range]. | |
def _normalize_time(self, data:xr.DataArray,attrs:dict) -> xr.DataArray: | |
"""Normalize the time in the range between [end_time, end_time - time_range]. |
I'm not sure why the linter isn't marking the spaces or the docstring first word. Ruff must not be able to do that yet.
if data.size == 0 : | ||
LOG.error(f"All the flash_age events happened before {begin_time}") | ||
sys.exit(1) |
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.
Composites should not be exiting the system. Some exception should be raised or an empty image/composite should be the result.
new_attrs = data.attrs.copy() | ||
self._update_missing_metadata(new_attrs, attrs) | ||
new_attrs = self._redefine_metadata(new_attrs) | ||
return self._normalize_time(data,new_attrs) |
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.
return self._normalize_time(data,new_attrs) | |
return self._normalize_time(data, new_attrs) |
dict: atualised attributes | ||
""" | ||
attrs["name"] = self.standard_name | ||
attrs["standard_name"] =self.standard_name |
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.
attrs["standard_name"] =self.standard_name | |
attrs["standard_name"] = self.standard_name |
# Normalize the time values | ||
normalized_data = (data - begin_time) / (end_time - begin_time) | ||
# Ensure the result is still an xarray.DataArray | ||
return xr.DataArray(normalized_data, dims=data.dims, coords=data.coords,attrs=attrs) |
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.
return xr.DataArray(normalized_data, dims=data.dims, coords=data.coords,attrs=attrs) | |
return xr.DataArray(normalized_data, dims=data.dims, coords=data.coords, attrs=attrs) |
# Get the time_range which is in minute | ||
self.time_range = self.attrs["time_range"] | ||
self.standard_name = self.attrs["standard_name"] | ||
self.reference_time = self.attrs["reference_time"] |
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 is actually the name of the attribute in the DataArray.attrs
, right? Could this be renamed reference_time_attr
or something?
This Merge request is there to create the flash age compositor related to the li instrument.