Created
May 12, 2014 11:42
-
-
Save sjpfenninger/55774f73cbfa12865185 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"worksheets": [ | |
{ | |
"cells": [ | |
{ | |
"metadata": {}, | |
"cell_type": "code", | |
"input": "import pandas as pd\n\nimport datatools\nimport gsee", | |
"prompt_number": 1, | |
"outputs": [], | |
"language": "python", | |
"trusted": true, | |
"collapsed": false | |
}, | |
{ | |
"metadata": {}, | |
"cell_type": "code", | |
"input": "sites = ['Sede Boqer', 'Solar Village', 'Tamanrasset']\n\ncoordinates = [(30.8597, 34.7794), (24.91, 46.41), (22.7903, 5.5292)]", | |
"prompt_number": 2, | |
"outputs": [], | |
"language": "python", | |
"trusted": true, | |
"collapsed": false | |
}, | |
{ | |
"metadata": {}, | |
"cell_type": "heading", | |
"source": "Get AOD data", | |
"level": 1 | |
}, | |
{ | |
"metadata": {}, | |
"cell_type": "markdown", | |
"source": "Not included here (happens in `~/Data/Solar/ImperialDust/read_dust-cleaned.ipynb`)." | |
}, | |
{ | |
"metadata": {}, | |
"cell_type": "heading", | |
"source": "Get MERRA data", | |
"level": 1 | |
}, | |
{ | |
"metadata": {}, | |
"cell_type": "markdown", | |
"source": "NB: this code only runs with access to MERRA data saved as compressed or uncompressed NetCDF from the MAT1NXRAD table (in `merra_path`) -- ignore if no MERRA data available" | |
}, | |
{ | |
"metadata": {}, | |
"cell_type": "code", | |
"input": "# get CSV files with MERRA data - requires access to the downloaded data\nmerra_path = '/Volumes/data/merra_imperialdust'\ndates = pd.date_range('2008-01-01', '2009-12-31')\ndata = datatools.get_merra(merra_path, coordinates,\n ['swtdn', 'swgdn', 'albedo'], dates)", | |
"prompt_number": 3, | |
"outputs": [], | |
"language": "python", | |
"trusted": true, | |
"collapsed": false | |
}, | |
{ | |
"metadata": {}, | |
"cell_type": "code", | |
"input": "# This only works if `sites` is a list with the same order as `coordinates`\n\nfor i in range(len(data)):\n data.ix[i].to_csv('merra ' + sites[i] + '.csv')", | |
"prompt_number": 6, | |
"outputs": [], | |
"language": "python", | |
"trusted": true, | |
"collapsed": false | |
}, | |
{ | |
"metadata": {}, | |
"cell_type": "heading", | |
"source": "Apply BRL model to MERRA data", | |
"level": 1 | |
}, | |
{ | |
"metadata": {}, | |
"cell_type": "code", | |
"input": "# Read CSV file with MERRA data\nsite_data = pd.read_csv('merra Solar Village.csv', index_col=0,\n parse_dates=True)", | |
"prompt_number": 11, | |
"outputs": [], | |
"language": "python", | |
"trusted": true, | |
"collapsed": false | |
}, | |
{ | |
"metadata": {}, | |
"cell_type": "code", | |
"input": "# Global horizontal irradiance and clearness index for the BRL model\nghi = site_data['swgdn']\nclearness = site_data['swgdn'] / site_data['swtdn']\n\n# Coordinates for the selected site\nsite_coords = coordinates[1] # pick the right entry from coordinates list\n\nresult = gsee.processing.apply_brl_model(ghi, clearness, site_coords)", | |
"prompt_number": 12, | |
"outputs": [], | |
"language": "python", | |
"trusted": true, | |
"collapsed": false | |
}, | |
{ | |
"metadata": {}, | |
"cell_type": "heading", | |
"source": "Get irradiance on any aperture", | |
"level": 1 | |
}, | |
{ | |
"metadata": {}, | |
"cell_type": "code", | |
"input": "result.columns", | |
"prompt_number": 14, | |
"outputs": [ | |
{ | |
"output_type": "pyout", | |
"prompt_number": 14, | |
"metadata": {}, | |
"text": "Index([u'global_horizontal', u'diffuse_fraction', u'direct_normal'], dtype='object')" | |
} | |
], | |
"language": "python", | |
"trusted": true, | |
"collapsed": false | |
}, | |
{ | |
"metadata": {}, | |
"cell_type": "code", | |
"input": "dir_horiz = result.global_horizontal * (1- result.diffuse_fraction)\ndiff_horiz = result.global_horizontal * result.diffuse_fraction\n\nplane_irradiance = gsee.trigon.aperture_irradiance(dir_horiz, diff_horiz,\n coordinates[1], tracking=1,\n azimuth=1.2)", | |
"prompt_number": 15, | |
"outputs": [], | |
"language": "python", | |
"trusted": true, | |
"collapsed": false | |
}, | |
{ | |
"metadata": {}, | |
"cell_type": "markdown", | |
"source": "Arguments for `aperture_irradiance`:\n\n* direct : a series of direct horizontal irradiance with a datetime index\n* diffuse : a series of diffuse horizontal irradiance with the same datetime index as for direct\n* coords : (lat, lon) tuple of location coordinates\n* tilt : angle of panel relative to the horizontal plane, 0 = flat\n* azimuth : deviation of the tilt direction from the meridian, 0 = towards pole, going clockwise, 3.14 = towards equator\n* tracking : 0 (none, default), 1 (tilt), or 2 (tilt and azimuth). If 1, azimuth is the orientation of the tilt axis, which can be horizontal (tilt=0) or tilted.\n* albedo : reflectance of the surrounding surface\n* dni_only : only calculate and directly return a DNI time series (ignores tilt, azimuth, tracking and albedo arguments)" | |
}, | |
{ | |
"metadata": {}, | |
"cell_type": "code", | |
"input": "", | |
"outputs": [], | |
"language": "python", | |
"trusted": true, | |
"collapsed": false | |
} | |
], | |
"metadata": {} | |
} | |
], | |
"metadata": { | |
"name": "", | |
"signature": "sha256:1c3d2060712e3f8d34a8e6c7331282765f9308632029a573bef5ec40ccb665b7" | |
}, | |
"nbformat": 3 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment