-
Notifications
You must be signed in to change notification settings - Fork 302
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 LST Backward Average script #333
Add LST Backward Average script #333
Conversation
@jonasViehweger Can you please review? |
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.
One question about the calculationDate
, mainly why this is done in the script and not through setting the process API request to a different end date.
Other than that looks good!
planetary-variables/land-surface-temperature/land-surface-temperature-backward-average/raw.js
Show resolved
Hide resolved
const date = "2022-12-31"; // The date for which the backward average is calculated | ||
const nDays = 20; // The number of days to load data for | ||
const scaleFactor = 100; // The scale factor for the SWC values | ||
const defaultVis = true; // If true, the default visualization will be applied. If false, the color_min and color_max values will be used. |
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.
Here it's the same as for SWC, we can now set the min/max directly in the ColorRamp, so no need to do it ourselves.
const defaultVis = true; // If true, the default visualization will be applied. If false, the color_min and color_max values will be used. |
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.
Initially I did not add this to be able to have a defaultVis
just like the other LST custom script examples. But I agree it would be better to immediately include the update in the ColorRampVisualizer
initialization. Therefore, I have updated it.
function updateCMap(min, max) { | ||
const numIntervals = cmap.length; | ||
const intervalLength = (max - min) / (numIntervals - 1); | ||
for (let i = 0; i < numIntervals; i++) { | ||
cmap[i][0] = min + intervalLength * i; | ||
} | ||
} | ||
|
||
// Update the min max of color bar if defaultVis set to false | ||
if (!defaultVis) updateCMap(color_min, color_max); | ||
|
||
// Initialize the ColorRamp | ||
const visualizer = new ColorRampVisualizer(cmap); |
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.
function updateCMap(min, max) { | |
const numIntervals = cmap.length; | |
const intervalLength = (max - min) / (numIntervals - 1); | |
for (let i = 0; i < numIntervals; i++) { | |
cmap[i][0] = min + intervalLength * i; | |
} | |
} | |
// Update the min max of color bar if defaultVis set to false | |
if (!defaultVis) updateCMap(color_min, color_max); | |
// Initialize the ColorRamp | |
const visualizer = new ColorRampVisualizer(cmap); | |
// Initialize the ColorRamp | |
const visualizer = new ColorRampVisualizer(cmap, color_min, color_max); |
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.
See comment above. Updated.
@jonasViehweger Thanks for the review, I have added the changes! |
* Initial setup LST Backwar Average scripts and docs * Create and update color ramp in one command --------- Co-authored-by: Amber Mulder <[email protected]>
Add documentation and evalscripts on computation of Land Surface Temperature Backward Average.