Skip to content

Instantly share code, notes, and snippets.

View nocollier's full-sized avatar

Nathan Collier nocollier

  • Oak Ridge National Laboratory
  • Tennessee
View GitHub Profile
@nocollier
nocollier / AMFtoNetCDF4.py
Created February 6, 2019 03:13
A tool to convert Ameriflux CSV files into a CF-compliant netCDF4 format
"""
Converts csv files downloaded from the Ameriflux archive into a CF-compliant netCDF4 file.
"""
import argparse
import glob
import re
import xlrd
import numpy as np
import cftime as cf
from netCDF4 import Dataset
@nocollier
nocollier / Scripps_CO2_to_netCDF4.py
Last active February 1, 2019 19:45
Converts Scripps CO2 Mauna Loa data into a CF-compliant netCDF4 file for use in ILAMB
import numpy as np
from netCDF4 import Dataset
import pylab as plt
import os
import time
from urllib.request import urlretrieve
remote_source = "http://scrippsco2.ucsd.edu/assets/data/atmospheric/stations/in_situ_co2/monthly/monthly_in_situ_co2_mlo.csv"
gist_source = "https://gist.github.com/nocollier/d73585731756fa472731065389af45dc"
local_source = os.path.basename(remote_source)