Skip to content

Instantly share code, notes, and snippets.

😎
Solving solar

Mark Mikofski mikofski

😎
Solving solar
Block or report user

Report or block mikofski

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View tz_tools.py
from tzwhere import tzwhere
from datetime import datetime
import pytz
# timezone lookup, force nearest tz for coords outside of polygons
WHERETZ = tzwhere.tzwhere(shapely=True, forceTZ=True)
# daylight savings time (DST) in northern hemisphere starts in March and ends
# in November and the opposite in southern hemisphere
JAN1 = datetime(2016, 1, 1) # date with standard time in northern hemisphere
JUN1 = datetime(2016, 6, 1) # date with standard time in southern hemisphere
@mikofski
mikofski / Analysis of NREL mPERT Data for Validating Models.ipynb
Last active Nov 10, 2016
comparison of NREL mPERT data with SAPM model
View Analysis of NREL mPERT Data for Validating Models.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mikofski
mikofski / release_robot.py
Last active Apr 5, 2017
gets sorted list of latest git tags - part of dulwich.contrib see PR #462 and #489
View release_robot.py
"""Determine last version string from tags.
Alternate to `Versioneer <https://pypi.python.org/pypi/versioneer/>`_ using
`Dulwich <https://pypi.python.org/pypi/dulwich>`_ to sort tags by time from
newest to oldest.
Copy the following into the package ``__init__.py`` module::
from dulwich.contrib.release_robot import get_current_version
__version__ = get_current_version('..')
@mikofski
mikofski / models.py
Created Jul 19, 2016
django derived database field
View models.py
from __future__ import unicode_literals
from django.db import models
class HeaderField(models.CharField):
"""
Custom field class based on :class:`~django.db.models.CharField` that
creates a unique header from the header, data source and site coordinates.
"""
def pre_save(self, model_instance, add):
@mikofski
mikofski / darwin.mk
Last active Jul 10, 2016
overloading ccompiler to build dylibs for mac osx with xcode
View darwin.mk
#define macros
SOLPOSAM = libsolposAM.dylib
SOLPOSAM_LIB = solposAM
SPECTRL2 = libspectrl2.dylib
SPECTEST = spectest
STEST00 = stest00
SRC_DIR = src
BUILD_DIR = build
View invalid_rain_map.geojson
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View spectral_mismatch.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View autovivication.json
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
@mikofski
mikofski / gen_refs.js
Last active Aug 29, 2015
reference generator using counters
View gen_refs.js
/* Build a references section that lists URLs of hyperlinks
* with specified class "ref". Put list in div element with
* specified id "references". Use CSS class called references
* that uses counters and ::before psuedo-element to add
* brackets around reference list numbers.
* links in body look like this:
* blah <a href="URL>reference</a><a class="ref"><a> */
document.body.onload = gen_refs("a", "references", "ref");
function gen_refs(tagname, refsname, classname) {
var alltags = document.getElementsByTagName(tagname);
@mikofski
mikofski / rc2a1.m
Created Nov 25, 2014
convert MS Excel row-column reference to A1 reference
View rc2a1.m
function [a1,aa] = rc2a1(row,col)
% RC2A1 convert row, column reference to A1 reference for excel
% A1 = RC2A1(ROW,COL) returns the equivalent reference as a string
% for the given row, ROW, and column, COL, numbers.
a1 = char(64+mod(col-1,26)+1);
xcol = ceil(col/26)-1;
if xcol>0
[~,aa] = rc2a1(row,xcol);
a1 = [aa,a1];
You can’t perform that action at this time.