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

Hackathon #28

Merged
merged 4 commits into from
Feb 16, 2024
Merged

Hackathon #28

merged 4 commits into from
Feb 16, 2024

Conversation

XavierHubOcean
Copy link
Contributor

Adding the WindEurope folder and notebooks to the Hackathons folder

@henriktorget
Copy link
Contributor

Can we delete the DNB hackathon files?

@henriktorget
Copy link
Contributor

image

Seaborn and mpl_toolkits are not installed by default in the workspaces.
Can we add a code block for pip installing them in the notebook?

@henriktorget
Copy link
Contributor

image
The paths should be updated to work within the workspaces environment.

@henriktorget
Copy link
Contributor

Can we update the examples to fetch the data from vestas? I have attached the json schemas for the endpoints and example code here:

aggregation_query_input.json
threshold_query_input.json
timeseries_area_query_input.json
timeseries_closestpoint_query_input.json

import requests
import json


################ POST Timeseries Query ######################
#############################################################
api_url = "https://public-dev.api.vestas.com/public/vestas-climate-library/v1/timeseriesquery"
headers =  {
    "Content-Type":"application/json",
    "api_key": "x5b13DOiwixsUPeCZfPTXTz26SEibL1y"
}
request = {
  "latitude": 46.90,
  "longitude": -78.286,
  "startDate": "2011-01-01T00:00:00.000Z",
  "endDate": "2024-01-30T15:11:51.021Z",
  "vars4D": [
    "wsp"
  ],
  "vars3D": [
    "t2"
  ],
  "heights": [
    21.3,
    80
  ]
}
response = requests.post(api_url, data=json.dumps(request), headers=headers)
print("Timeseries Query: ")
print(response.json())



################ POST Threshold Query ################################################################
#######################################################################################################
api_url = "https://public-dev.api.vestas.com/public/vestas-climate-library/v1/thresholdquery"
headers =  {
    "Content-Type":"application/json",
    "api_key": "x5b13DOiwixsUPeCZfPTXTz26SEibL1y"
}
request = {
    "maxxlat":50.1,
    "maxxlong":14.4,
    "minxlat":50.0,
    "minxlong":14.2,
    "starttime":"2022",
    "endtime":"2023",
    "zHeights":[20,30,40],
    "tc_min":-15,
    "tc_max":15
}
response = requests.post(api_url, data=json.dumps(request), headers=headers)
print("Threshold Query: ")
print(response.json())



################ POST Aggregation Query ################################################################
#######################################################################################################
api_url = "https://public-dev.api.vestas.com/public/vestas-climate-library/v1/aggregationquery"
headers =  {
    "Content-Type":"application/json",
    "api_key": "x5b13DOiwixsUPeCZfPTXTz26SEibL1y"
}
request = {
    "maxxlat":50.1,
    "maxxlong":14.4,
    "minxlat":50.0,
    "minxlong":14.2,
    "starttime":"20230101",
    "endtime":"20230131",
    "selectedFunction":{
        "MIN":{
            "3DVars":["t2"]
        }
    }
}
response = requests.post(api_url, data=json.dumps(request), headers=headers)
print("Aggregation Query: ")
print(response.json())


################ POST Time Series Area Query ##########################################################
#######################################################################################################
api_url = "https://public-dev.api.vestas.com/public/vestas-climate-library/v1/timeseriesareaquery"
headers =  {
    "Content-Type":"application/json",
    "api_key": "x5b13DOiwixsUPeCZfPTXTz26SEibL1y"
}
request = {
    "minxlat":41,
    "minxlong":-100,
    "maxxlat":42,
    "maxxlong":-99,
    "starttime":"20220501",
    "endtime":"20220831",
    "selectedVariables":{
        "4DVars":["wsp","wdir","tk"],
        "zHeights":[50,150]
    }
}
response = requests.post(api_url, data=json.dumps(request), headers=headers)
print("Timeseriea Area Query: ")
print(response.json())



################ Get Query Status ################################################################
##################################################################################################
api_url = "https://public-dev.api.vestas.com/public/vestas-climate-library/v1/querystatus/4d1cc6e3-e508-4e8c-9d6c-641adb4af0b6"
headers =  {
    "Content-Type":"application/json",
    "api_key": "x5b13DOiwixsUPeCZfPTXTz26SEibL1y"
}
response = requests.get(api_url, headers=headers)
print("Query Status: ")
print(response.json())



################ Get Paginated Query Result ######################################################
##################################################################################################
api_url = "https://public-dev.api.vestas.com/public/vestas-climate-library/v1/queryresult/4d1cc6e3-e508-4e8c-9d6c-641adb4af0b6/1"
headers =  {
    "Content-Type":"application/json",
    "api_key": "x5b13DOiwixsUPeCZfPTXTz26SEibL1y"
}
response = requests.get(api_url, headers=headers)
print("Query Result: ")
print(response.json())

@henriktorget
Copy link
Contributor

The JSON for the data (the one between 50N8W – 60N12E is like this:

{
  "input_json": {
    "selectedFunction": {
      "AVG": {
        "4DVars": [
          "wsp",
          "tk"
        ],
        "3DVars": [
          "hgt",
          "t2",
          "sst",
          "pblh"
        ],
        "zHeights": [
          70,
          140,
          280
        ]
      },
      "MAX": {
        "4DVars": [
          "wsp"
        ],
        "3DVars": [
          "t2"
        ],
        "zHeights": [
          70,
          140,
          280
        ]
      },
      "MIN": {
        "3DVars": [
          "t2"
        ]
      }
    },
    "minxlat": 50,
    "minxlong": -8,
    "maxxlat": 60,
    "maxxlong": 12
  }
}

XavierPivan and others added 2 commits February 16, 2024 10:14
Restructuring the Hackathon folder and fixing import and path to fit …
Copy link
Contributor

@henriktorget henriktorget left a comment

Choose a reason for hiding this comment

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

Great stuff!

@henriktorget henriktorget merged commit 58c374c into master Feb 16, 2024
10 of 19 checks 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.

None yet

2 participants