Skip to content

Instantly share code, notes, and snippets.

View joAschauer's full-sized avatar

Johannes Aschauer joAschauer

View GitHub Profile
@joAschauer
joAschauer / calculate_deltasnow.R
Last active July 8, 2021 08:27
use nixmass R package from python
# this file can be sourced from python with rpy2
library(nixmass)
calculate_deltasnow <- function(df_in){
#' Calculate nixmass delta snow and return dataframe instead of nixmass object
#'
#' @param df_in The dataframe containing the data
#
if(df_in$hs[1]!=0) {
@joAschauer
joAschauer / read_smet.py
Last active May 4, 2022 08:03
Read .smet file as pd.Dataframe. quick and dirty solution to read timeseries from a .smet file as pd.Dataframe. Assumes that a 'timestamp' field is present in the .smet file. The function has not been tested on many files. Use on your own responsibility.
import configparser
from io import StringIO
import pandas as pd
def read_smet(file):
"""
Read a .smet file as pd.Dataframe
Parameters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@joAschauer
joAschauer / try_cosmo_rea6_atlite.ipynb
Created July 31, 2023 13:55
Compare the performance between ERA5 and COSMO REA6 reanalysis for wind power calculation with atlite.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@joAschauer
joAschauer / column_rounding.R
Created November 11, 2023 21:30
rounding columns in R dataframe based on condition
library(dplyr)
df <- structure(
list(
column1 = c(0.001234,
0.564324,
1.234342,
0.007839,
0.837483,
2.493993),
column2 = c(0.123493,