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

Generate forecast menu dynamically #213

Conversation

ricardogsilva
Copy link

@ricardogsilva ricardogsilva commented Aug 29, 2024

This PR implements new API endpoints for providing the frontend with an appropriate set of valid combinations for generating a navigation for forecast datasets.

Combinations of parameters are generated like this:

  • one entry for each combination of climatological_variable - aggregation_period - measure (e.g. tas-30yr-anomaly)
  • for that entry, list all valid combinations of the remaining parameters

This way of combining the existing parameters allows us to correctly represent entries like:

  • how the snwdays dataset has both 30yr anomaly and a annual absolute entries and they support different combinations of other parameters
  • the HWDI dataset, which is only available in the JJA season
  • the fact that TAS annual anomaly does not have a time_window, but TAS 30yr anomaly does have it

for example:

{
      "variable": "tas",
      "aggregation_period": "30yr",
      "measure": "anomaly",
      "other_parameters": {
        "year_period": [
          "MAM",
          "JJA",
          "SON",
          "DJF"
        ],
        "climatological_model": [
          "model_ensemble",
          "ec_earth_cclm_4_8_17",
          "ec_earth_racmo22e",
          "ec_earth_rca4",
          "hadgem2_racmo22e",
          "mpi_esm_lr_remo2009"
        ],
        "scenario": [
          "rcp45",
          "rcp26",
          "rcp85"
        ],
        "time_window": [
          "tw2",
          "tw1"
        ]
      }
    }

The new endpoint is reachable at:

/api/v2/variable-combinations

it returns an object with this structure:

{
  combinations: []
  translations: {}
}

where combinations is a list of objects describing entries as mentioned above and translations is an object with the translation for the various parameters, allowing the construction of a localized navigation in both english and italian


@ricardogsilva ricardogsilva force-pushed the 211-provide-forecast-dataset-combinations-for-the-frontend branch from a039da4 to 26510d6 Compare September 2, 2024 16:11
@ricardogsilva ricardogsilva marked this pull request as ready for review September 2, 2024 16:18
@francbartoli francbartoli merged commit c94a0f2 into geobeyond:main Sep 2, 2024
1 check passed
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.

provide forecast dataset combinations for the frontend
2 participants