Skip to content

Instantly share code, notes, and snippets.

View mikkopitkanen's full-sized avatar

Mikko Pitkänen mikkopitkanen

View GitHub Profile
@mikkopitkanen
mikkopitkanen / regression_estimators.py
Created April 18, 2019 06:35
This script demontrates the importance of proper treatment of data uncertainties when performing linear regression for statistical inference (how strongly y depends on x).
"""Demonstrate how to calculate various linear regression estimates.
Copyright (C) 2019 Mikko Pitkanen
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
@mikkopitkanen
mikkopitkanen / colorbar_offset.py
Created March 21, 2019 14:03
An example on how to normalize and create offset to colorbar using matplotlib. This example simply combines two separate examples from the online sources mentioned in the code, so the credits go to the original authors (see the docstrings).
"""Show how to normalize and offset colorbar.
mikko.pitkanen@fmi.fi, 2018-03-06
Credits to people at scitools.org.uk and matplotlib.org.
Adopted from (on 2018-03-06):
http://scitools.org.uk/cartopy/docs/latest/gallery/waves.html#sphx-glr-gallery-waves-py
Contains public sector information licensed under the Open Government Licence
v2.0.
@mikkopitkanen
mikkopitkanen / fit_bivariate.py
Created March 21, 2019 09:56
Perform linear regression fit using the algorithm presented by York et al. (2004)
"""Function for fitting York, 2004, bivariate fit.
Copyright (C) 2019 Mikko Pitkanen
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
@mikkopitkanen
mikkopitkanen / calc_solar_time.py
Last active November 25, 2022 14:15
Return solar time for given longitude and UTC time. This function uses the low accuracy equations presented in General Solar Position Calculations (https://www.esrl.noaa.gov/gmd/grad/solcalc/solareqns.PDF, valid 2018-11-06) published by Global Radiation Group, NOAA Global Monitoring Division.
"""Copyright (C) 2018 Mikko Pitkänen.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the