Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mjaehn committed Jun 21, 2024
1 parent 7d11e5c commit 673faed
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
32 changes: 32 additions & 0 deletions check_datasets.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import requests
import json
import re
import boto3

def download_json(url):
response = requests.get(url)
return json.loads(response.text)

def read_markdown(file_path):
with open(file_path, 'r') as file:
return file.read()

def write_markdown(file_path, content):
with open(file_path, 'w') as file:
file.write(content)

def update_markdown(markdown, json_data):
# This is a placeholder. You'll need to replace this with the actual logic
# to update the markdown content based on the JSON data.
return re.sub(r'(Size: )(\d+ TB)', r'\1' + str(json_data['size']) + ' TB', markdown)

# Main part of the script
json_data1 = download_json('https://zephyr-c2sm.s3.eu-central-1.amazonaws.com/datasets.json')
json_data2 = download_json('https://zephyr-c2sm.s3.eu-central-1.amazonaws.com/file_tree_cordex_noindent.json')

markdown = read_markdown('climate_model_data.md')

updated_markdown = update_markdown(markdown, json_data1)
updated_markdown = update_markdown(updated_markdown, json_data2)

write_markdown('climate_model_data.md', updated_markdown)
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
requests==2.26.0
boto3==1.18.33

0 comments on commit 673faed

Please sign in to comment.