Skip to content

Instantly share code, notes, and snippets.

View NikosAlexandris's full-sized avatar
🎯
Focusing

Nikos Alexandris NikosAlexandris

🎯
Focusing
View GitHub Profile
@NikosAlexandris
NikosAlexandris / gist:3fb842426e3016a7ef9828cbff5732dc
Created February 16, 2025 14:09
venho.ai logs via nerdctl while successfully logging in without prior communication of successful account creation
(venho-ada)[root@Mind2 defaultuser]# nerdctl compose logs -f
frontend-httpd-1 |/docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
frontend-httpd-1 |/docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
frontend-httpd-1 |/docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
frontend-httpd-1 |10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf
frontend-httpd-1 |10-listen-on-ipv6-by-default.sh: info: Enabled listen on IPv6 in /etc/nginx/conf.d/default.conf
frontend-httpd-1 |/docker-entrypoint.sh: Sourcing /docker-entrypoint.d/15-local-resolvers.envsh
frontend-httpd-1 |/docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
frontend-httpd-1 |/docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
frontend-httpd-1 |/docker-entrypoint.sh: Configuration complete; ready for start up
@NikosAlexandris
NikosAlexandris / plot_polar_horizon_height_profile.py
Last active December 19, 2024 20:42
Experimental polar plots of horizon height angles using Uniplot
import numpy
from uniplot import plot
from rich import print
# Generate equidistant azimuthal directions, say 64 + 1
azimuthal_directions_degrees = numpy.linspace(0, 360, 65)
azimuthal_directions_radians = numpy.radians(azimuthal_directions_degrees)
x_azimuth = numpy.sin(azimuthal_directions_radians)
y_azimuth = numpy.cos(azimuthal_directions_radians)
@NikosAlexandris
NikosAlexandris / gist:4cead432137f3a74c5e3ef3a4ddf9377
Created December 16, 2024 17:01
Modified version of polar_ascii.py
# Based on [polar_ascii.py](https://github.com/tfpgh/polar_ascii/blob/214229c66c554335fb35c535ff2fb768102e4da4/polar_ascii.py)
import importlib.util
import math
import os
import sys
# number of points per degree in the domain
ITERATION_MULTIPLE = 10
SCALE_DIVISOR = 6
@NikosAlexandris
NikosAlexandris / example_from_readme.py
Last active January 22, 2024 10:58
Example using DaCe
import dace
import numpy as np
import time as timer
from rich import print
REPETITIONS_DEFAULT = 10
@dace
def myprogram_daced(a):
for i in range(a.shape[0]):
@NikosAlexandris
NikosAlexandris / store_attributes
Created November 11, 2023 15:59
Store attributes before and after functions run in SingleHdf5ToZarr.translate()
- Attribute name _nc3_strict with value 1
- Attribute name _NCProperties with value b'version=2,netcdf=4.7.3,hdf5=1.10.6,'
- Attribute name Conventions with value b'CF-1.7,ACDD-1.3'
+ Attribute value = 'CF-1.7,ACDD-1.3' will be fed to n = 'Conventions' in 'zobj.attrs[Conventions]'
- Attribute name id with value b'DOI:10.5676/EUM_SAF_CM/SARAH/V003'
+ Attribute value = 'DOI:10.5676/EUM_SAF_CM/SARAH/V003' will be fed to n = 'id' in 'zobj.attrs'
- Attribute name product_version with value b'3.0'
+ Attribute value = '3.0' will be fed to n = 'product_version' in 'zobj.attrs'
@NikosAlexandris
NikosAlexandris / combine_parquet_stores_failure_to_fetch_target
Created November 9, 2023 15:39
Failure to fetch target while combining parquet stores
This file has been truncated, but you can view the full file.
Input references : ['SISin202001020000004231000101MA.parquet', 'SISin202001010000004231000101MA.parquet']
Out is : {'.zgroup': b'{"zarr_format":2}'}
Out is : {'time/.zarray': b'{"chunks":[512],"compressor":null,"dtype":"<f8","fill_value":null,"filters":[{"id":"zlib","level":4}],"order":"C","shape":[48],"zarr_format":2}'}
Out is : {'time/0': FileNotFoundError('/SISin202001020000004231000101MA.nc')}
Out is : {'.zgroup': b'{"zarr_format":2}'}
Out is : {'time/.zarray': b'{"chunks":[512],"compressor":null,"dtype":"<f8","fill_value":null,"filters":[{"id":"zlib","level":4}],"order":"C","shape":[48],"zarr_format":2}'}
Out is : {'time/0': FileNotFoundError('/SISin202001010000004231000101MA.nc')}
Out is : {'.zgroup': b'{"zarr_format":2}'}
Out is : {'time/.zarray': b'{"chunks":[512],"compressor":null,"dtype":"<f8","fill_value":null,"filters":[{"id":"zlib","level":4}],"order":"C","shape":[48],"zarr_format":2}'}
Out is : {'time/.zattrs': b'{"_ARRAY_DIMENSIONS":["time"],"axis":"T"}'}
@NikosAlexandris
NikosAlexandris / kerchunk_to_parquet.py
Created November 8, 2023 14:29
Create a Parquet store for SARAH3 products in form of NetCDF files using Kerchunk (after https://github.com/fsspec/kerchunk/pull/391)
from pathlib import Path
from functools import partial
import typer
from typing import Optional
import xarray as xr
from rich import print
import fsspec
from fsspec.implementations.reference import LazyReferenceMapper
from kerchunk.hdf import SingleHdf5ToZarr
from kerchunk.combine import MultiZarrToZarr
@NikosAlexandris
NikosAlexandris / kerchunk_to_parquet.py
Created November 6, 2023 20:18
Create a Parquet store for SARAH3 products in form of NetCDF files using Kerchunk
import typer
import hashlib
from pathlib import Path
from functools import partial
import multiprocessing
from fsspec.implementations.reference import LazyReferenceMapper
import kerchunk
import os
import fsspec
from kerchunk.hdf import SingleHdf5ToZarr
@NikosAlexandris
NikosAlexandris / suggest.py
Created November 3, 2023 19:33
Determine optimal chunk shape for a 3D array
import math
import operator
import numpy as np
from itertools import product
from functools import reduce
import typer
from pvgisprototype.cli.typer_parameters import OrderCommands
from pydantic import BaseModel, ValidationError, conlist
from pydantic import ConfigDict
from pydantic import field_validator
@NikosAlexandris
NikosAlexandris / gist:2ea12e74cc72f7eb1a326e8b9b903aef
Created October 27, 2023 12:55
Checking chunk sizes [DRAFT]
@app.command(
'check-chunks',
no_args_is_help=True,
help='Check for chunk size consistency along series of files in a format supported by Xarray',
)
def check_chunk_consistency(
source_directory: Annotated[Path, typer_argument_source_directory],
pattern: Annotated[str, typer_option_filename_pattern] = "*.json",
verbose: Annotated[int, typer.Option(..., "--verbose", "-v", count=True, help="Increase verbosity level.")] = 0,
):