-
Notifications
You must be signed in to change notification settings - Fork 184
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
WV-3190 Smallest Subdaily Timeline Interval #5244
WV-3190 Smallest Subdaily Timeline Interval #5244
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.
export function getSmallestIntervalValue(state) { | ||
const layers = getActiveLayers(state); | ||
let smallestDelta = 1440; | ||
if (layers && layers.length) { |
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 would refactor this to only call lodashGet(layers[i], 'dateRanges[0].dateInterval')
once.
for (let i = 0; i < layers.length; i += 1) {
let interval = lodashGet(layers[i], 'dateRanges[0].dateInterval');
if (layers[i].period === 'subdaily' && interval < smallestDelta) {
smallestDelta = Number(interval);
}
}
}
const subdailyInterval = customInterval > 3 || interval > 3; | ||
|
||
if (subdailyRemoved && subdailyInterval) { | ||
changeCustomInterval(); | ||
selectInterval(1, TIME_SCALE_TO_NUMBER.day, false); | ||
} | ||
|
||
if (subdailyAdded && !customSelected) { | ||
changeCustomInterval(10, TIME_SCALE_TO_NUMBER.minute); | ||
if (subDailyCountChanged) { |
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'd prefer if we clearly define the 1440 value for readability sake.
if (subDailyCountChanged) {
const isSubDaily = newCustomDelta !== 1440; // or < 1440, if that makes more sense
if (isSubDaily) {
changeCustomInterval(newCustomDelta, TIME_SCALE_TO_NUMBER.minute);
} else {
changeCustomInterval(1, TIME_SCALE_TO_NUMBER.day);
}
}
Description
This code change changes the behavior of the timeline interval for subdaily layers. Firstly, it allows for subdaily layers to set a custom interval of something other than 10 minutes, and secondly, if multiple subdaily layers are present and have multiple custom intervals, the smallest interval is chosen.
How To Test
git checkout wv-3190-smallest-interval-subdaily
npm ci
npm run watch
VIIRS_NOAA20_CorrectedReflectance_TrueColor_Granule
.Himawari_AHI_Air_Mass
.