Skip to content

Instantly share code, notes, and snippets.

View gerritjandebruin's full-sized avatar

Gerrit Jan de Bruin gerritjandebruin

View GitHub Profile
@gerritjandebruin
gerritjandebruin / hide_prints.py
Created January 15, 2022 07:56
Hide any print statement
import os
import sys
class HiddenPrints:
def __enter__(self):
self._original_stdout = sys.stdout
sys.stdout = open(os.devnull, 'w')
def __exit__(self, exc_type, exc_val, exc_tb):
sys.stdout.close()
from osgeo import ogr
import pandas as pd
import geopandas as gpd
def get_data(file):
ds = ogr.Open(file)
result = list()
for lyr in ds:
for feat in lyr:
@gerritjandebruin
gerritjandebruin / import_lml_from_api.py
Created August 9, 2023 06:43
Import Landelijk Meetnetwerk Lucht (LML) data
from pathlib import Path
import requests
import pandas as pd
from tqdm import tqdm
def get_locations(base_url: str = "https://api.luchtmeetnet.nl/open_api/stations"):
"""Get all locations from the LML API.
Parameters:
-----------
@gerritjandebruin
gerritjandebruin / RIVM.ipynb
Created December 18, 2023 18:15
RIVM Luchtkwaliteitsindex kleuren
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.