clarity-h2020 / map-component

The Map Component is a reusable, flexible and highly configurable Building Block meant to be used throughout CSIS.
https://csis.myclimateservice.eu/
1 stars 1 forks source link

Support for multipe Scenarios #74

Closed p-a-s-c-a-l closed 4 years ago

p-a-s-c-a-l commented 4 years ago

ATM there is a 1:1 mapping between Template Resources and the actual layer generated by substituting template variables. There is one set of variables for each scenario.

Although, we allow user to define more than one scenario, selecting more than one scenario isn't possible ATM. Handling of variables is already unnecessary complex, so we shouldn't additionally mix up different scenarios in one map. Instead, the user should be able to select a scenario from a drop down box which reloads the map with the new set of variables applied. When creating a screenshot via the "include in report button", information about the selected scenario should be added to the comment.

Scenario Comparison can be handled in the Scenario Analysis Component.

patrickkaleta commented 4 years ago

See this comment for the current status of Study scenarios.

When creating a screenshot via the "include in report button", information about the selected scenario should be added to the comment.

I believe this could easily be accomplished by the csis-helpers module. ~I'll look into it.~

Currently working on it in the include-in-report feature branch. Adding the respective values from the StudyInfo object looks a bit ugly (especially for the time period). Might be better to add just the title of the selected Study scenario to the screenshot comment. The final report will then contain all the details for each Study scenario defined in that Study.

DenoBeno commented 4 years ago

I just noticed that multiple scenarios are enabled now.

Didn't test on other places.

p-a-s-c-a-l commented 4 years ago

No, it's not working. See this Example:

Currently selected Study scenario: 2071-2100; 20y; no measures Time Period: 2071 to 2100 Emissions Scenario: Business as usual Event Frequency: 20 years Study Variant: no Adaptation Options

Map iFrame Link generated:

...study_variant=BASELINE&time_period=20710101-21001231&emissions_scenario=rcp85&event_frequency=Rare&grouping_tag=taxonomy_term--hazards

@patrickkaleta drupalSettings.csisHelpers.studyInfo: doesn't yet contain information on the active scenario:

{
  "id": "18",
  "uuid": "5fa510eb-f21c-4cdc-88bf-c67ea6e83675",
  "write_permissions": 1,
  "name": null,
  "step": "1905",
  "step_uuid": "f7e661f7-c8f7-4b74-a248-1711fd21ea12",
  "study": "18",
  "study_uuid": "5fa510eb-f21c-4cdc-88bf-c67ea6e83675",
  "study_emikat_id": 3186,
  "calculation_status": "0",
  "study_datapackage_uuid": "2434ce93-93d4-4ca2-8618-a2de768d3f16",
  "study_area": "POLYGON((19.447474 51.764362,19.447474 51.781203,19.506651 51.781203,19.506651 51.764362,19.447474 51.764362))",
  "eea_city_name": null,
  "city_code": "PL002",
  "study_presets": {
    "time_period": "20710101-21001231",
    "emission_scenario": "rcp85",
    "event_frequency": "Rare",
    "study_variant": "BASELINE"
  },
  "study_scenarios": [
    {
      "label": "2071-2100; 20y; no measures",
      "time_period": "20710101-21001231",
      "emission_scenario": "rcp85",
      "event_frequency": "Rare",
      "study_variant": "BASELINE"
    },
    {
      "label": "2071-2100; 20y; effective",
      "time_period": "20710101-21001231",
      "emission_scenario": "rcp45",
      "event_frequency": "Rare",
      "study_variant": "BASELINE"
    },
    {
      "label": "historical, 20y",
      "time_period": "Baseline",
      "emission_scenario": "Baseline",
      "event_frequency": "Rare",
      "study_variant": "BASELINE"
    },
    {
      "label": "historical, yearly",
      "time_period": "Baseline",
      "emission_scenario": "Baseline",
      "event_frequency": "Frequent",
      "study_variant": "BASELINE"
    },
    {
      "label": "2071-2100; yearly; no measures",
      "time_period": "20710101-21001231",
      "emission_scenario": "rcp85",
      "event_frequency": "Frequent",
      "study_variant": "BASELINE"
    }
  ],
  "is_anonymous": false,
  "is_member": true
}

Furthermore, Map Component JS Connector is still looking at field study_presets.

patrickkaleta commented 4 years ago

No, it's not working. See this Example:

Currently selected Study scenario: 2071-2100; 20y; no measures Time Period: 2071 to 2100 Emissions Scenario: Business as usual Event Frequency: 20 years Study Variant: no Adaptation Options

Map iFrame Link generated:

...study_variant=BASELINE&time_period=20710101-21001231&emissions_scenario=rcp85&event_frequency=Rare&grouping_tag=taxonomy_term--hazards

Time perio: 2071 - 2110 <--> 20710101-21001231 Emissions Scenario: Business as usual <--> rcp85 Event Frequency: 20 years <--> rare Study Variant: no Adaptation Options <--> BASELINE

To me this URL fits to the selected scenario. Am I missing something?

@patrickkaleta drupalSettings.csisHelpers.studyInfo: doesn't yet contain information on the active scenario: ... Furthermore, Map Component JS Connector is still looking at field study_presets.

The active scenario is stored in the field study_presets. I changed the behaviour of the csis-helpers module, so that the active scenario would be stored in the same field, which has already been in use by the components. That's what I meant in my comment, when I said: "...the selected/active scenario will be stored and available in the studyInfo object just like it is right now, so the map component doesn't need to be adjusted"

I can rename the study_presets field in the $studyInfo to a more fitting name like "active_scenario", or create a duplicate of the study_presets field with a new name and remove the old field, once the components made the transition to the new field, or we can leave it as it is.

patrickkaleta commented 4 years ago

I just noticed that multiple scenarios are enabled now.

  • There is a warning on save that doesn't seem to affect the system negatively.
  • Presets work as designed in "local efects" - for table and for the map.

Didn't test on other places.

Are you talking about this warning message? Yes. it wasn't affecting the system but still annoying, so I fixed it.

p-a-s-c-a-l commented 4 years ago

To me this URL fits to the selected scenario. Am I missing something?

Time perio: 2071 - 2110 <--> 20710101-21001231 Emissions Scenario: Business as usual <--> rcp85 Event Frequency: 20 years <--> rare

Yes, you are right. I assumed that 'Business as usual' is RCP4.5 and 20 years is occasional. study_presets should stay as it is for now.

In my opinion, it would be better to use the same terminology in the UI and API. So either rcp85 or rcp85 (Business as usual) but not just Business as usual. Same for Event Frequency. Who knows that 20 years == rare? BTW, "Rare" will occur in other places in the UI, e.g. in the layer names or in the scenario analysis component. Same for RCP. Using different names for the same things is confusing, not only for end users. See also Naming things.

p-a-s-c-a-l commented 4 years ago

I renamed the taxonomies so that UI and code models are aligned. Basic support for different scenarios is available. It could be improved by showing 2 scenarios at once, but that's a different issue.