-
Notifications
You must be signed in to change notification settings - Fork 43
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
Improvements on parsing time from tiffs. #296
base: main
Are you sure you want to change the base?
Conversation
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.
Overall looks good ... just a minor feedback point.
Thanks for the feedback. The changes are now updated. |
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.
LGTM !
@@ -175,18 +175,22 @@ def _get_band_data(i): | |||
raise RuntimeError("Wrong regex passed in --forecast_time_regex.") | |||
ds.attrs['start_time'] = start_time | |||
ds.attrs['end_time'] = end_time | |||
elif 'start_time' in ds.attrs and 'end_time' in ds.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.
3 points
- Our tiff files do not preserve attrs so reading them with
xr.open_dataset(file.tiff, engine='rasterio')
will have emptyds.attrs
. - 'start_time' and 'end_time' in dataset attrs is in
2021-01-01T00:00:00Z
format so we need to parse it into datetime.datetime() for below datetime_value_s variable to initialize. start_time
is not being used. Can be skipped.
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.
Good points Deep.
May be we can pick this #159 (comment) next & restructure _preprocess_tif
altogether.
Fixes and improved codepath for parsing time from Tiffs. Useful for performing round-trip tests.