Skip to content
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

Solar Terminator #404

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open

Solar Terminator #404

wants to merge 22 commits into from

Conversation

belentorrente
Copy link
Collaborator

This MR introduces the CDataPostProcessor that calculates the Solar Terminator, which will assign one of five standard categories to a pixel (day, night, astronomical twilight, nautical twilight, and civil twilight) based on the solar zenith angle. Three test cases have been added.

The solar terminator algorithm itself is based on a book (Astronomical Algorithms, by Jean Meeus) that provides an approximation. An old scan of the book is available here, if you're interested.

More considerations:

  • The generic liveupdate layer has been left untouched, meaning that if a liveupdate with no post processors, it will go the pre-existing route, creating an image with the timestamp.
  • For this reason, at this point, the presence of a data post processor is the discriminator between a generic liveupdate, and a custom one (like the SolarTerminator).
  • I attempted to try and make something smart, like a virtual or temp file that is created when reading the config of the layer. Unfortunately, I haven't managed to make it work, as I was getting segmentation faults in numerous places in the code such as CDataWriter::addData, so I have discarded this idea (for now). So for now, and empty netCDF file is used. Another problem is that the units in the legend depend on this and I could not find the way of overwriting this in the data post processor.

const char *CDPPSolarTerminator::getId() { return "solarterminator"; }

#define SIZE 255
void CDPPSolarTerminator::print_trace() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is print_trace still needed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I think this is a very old copy/paste thing. I assumed it was a standard post processor thing and didn't look twice at it. Will remove!

@belentorrente belentorrente changed the base branch from master to store-layer-metadata September 23, 2024 10:57
@belentorrente belentorrente changed the base branch from store-layer-metadata to master September 24, 2024 13:32
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8" ?>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add the new option to https://github.com/KNMI/adaguc-server/blob/master/doc/configuration/Layer.md ?

Can you also write a tutorial in https://github.com/KNMI/adaguc-server/blob/master/doc/tutorials/Readme.md? E.g. copy this dataset configuration to the right place. And then looking at it in the viewer?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very good idea! Regarding Layer.md, I should probably add it under LiveUpdate, right?

Copy link
Collaborator Author

@belentorrente belentorrente Oct 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I have a not-so-good update. Basically the legend of the solar terminator is now broken (I noticed while making a screen capture for the documentation). If I make the GetLegendGraphic call it works fine (I have added a test for that), but when running Adaguc locally and accessing the dataset from the viewer, no styles are listed.
I think this is related to the metadata db setup (readFromDb is set to false). Maybe related to the variable/dimension check? There is a comment saying If variable name equals dimension name, values are stored in the database.
Any clues how to fix this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In adagucserverEC/utils/XMLGenUtils.cpp, line 751, you need to add ||
metadataLayer->dataSource->dLayerType == CConfigReaderLayerTypeLiveUpdate

Not sure what other consequences this has.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good find!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants