Skip to content

Instantly share code, notes, and snippets.

@mjs
mjs / mmap-mp.py
Created January 18, 2023 09:18
Example of how to use a anonymous mmap block with the multiprocessing module
from multiprocessing import Pool
import mmap
mm = mmap.mmap(-1, 12, flags=mmap.MAP_SHARED|mmap.MAP_ANONYMOUS)
n = mm.write(b"lots of data")
mm.seek(0)
print(mm.read().decode('ascii'))
mm.seek(0)
@MHBalsmeier
MHBalsmeier / eccodes_on_ubuntu.md
Last active October 9, 2024 20:07
How to install Eccodes on Ubuntu

How to Install Eccodes on Ubuntu

Eccodes is an open source library made by ECMWF for reading and writing grib files, which is the most common file format for meteorological und oceanographic data in operational use (while in research, Netcdf is mainly used). If one wants to work with grib files seriously, one will have to install it earlier or later. On top of that, one will also have to make sure C and Python code is able to import the library's functionality.

First of all, I would highly recommend not to use anything else than Linux, preferably Ubuntu, for working with meteorological data, especially grib files. If you do not want to migrate to Linux completely, consider either a dual boot or a virtual machine.

I just show you the commands with minimal explanation.

Installing an older version with apt

@dmontagu
dmontagu / app.py
Created February 18, 2020 00:28
FastAPI + dash
# Based on the example from https://www.activestate.com/blog/dash-vs-bokeh/
import dash
import dash_core_components as dcc
import dash_html_components as html
import pandas as pd
import plotly.graph_objs as obj
import uvicorn as uvicorn
from dash.dependencies import Input, Output
from fastapi import FastAPI
from starlette.middleware.wsgi import WSGIMiddleware