Skip to content
This repository has been archived by the owner on Aug 29, 2019. It is now read-only.

Spectral optimisation #1

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
solarcalc/_version.py export-subst
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
TMP
*.pyc
output*
*.zip
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
include versioneer.py
include solarcalc/_version.py
30 changes: 26 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,29 @@
# pysolarcalc

A python port of SolarCalc by Kurt Spokas

requires:
numpy
scipy
pysolarv>=0.7
Follows formulae largely from [Spokas and Forcella (2006)](https://pubag.nal.usda.gov/catalog/1910) and [this NREL tech report](https://rredc.nrel.gov/solar/pubs/spectral/model/section3.html)

### Usage:


```bash
# pip install -r requirements.txt && ./setup.py install OR
# conda env create -f dev-environment.yml && ./setup.py install


pysolarcalc --place $lat $lon $elev \
--light data/spectra/growtainer-wm2.csv \
--start 2019-01-01 \
--end 2019-12-31 \
--chamber-start 2020-01-01 \
--scale-factor 0.25 # see below
```


The main params are obvious (lat/long/elevation/start & end dates).
`--scale-factor` is a multiplier that accounts for the fact that a chamber
cannot produce the quantity of light the sun does, and allows one to optimise
spectra assuming that the sun was `scale_factor` times as bright. Defaults to
0.5, which is about right for our high light chambers. It should be set to
approximately `max(chamber par) / max(sun)`.
277 changes: 0 additions & 277 deletions Untitled.ipynb

This file was deleted.

Empty file removed __init__.py
Empty file.
Binary file not shown.
257 changes: 257 additions & 0 deletions data/spectra/growtainer-multispectral-wm2.csv

Large diffs are not rendered by default.

257 changes: 257 additions & 0 deletions data/spectra/growtainer-wm2.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,257 @@
wavelength,White,Red,FarRed
324,0.013549879826835,0.001060235279723,0.000328366413158
326,0.015096781435564,0.001640738696702,0.000196578198709
327,0.019403996709865,0.000988351833156,0.000127543052864
329,0.020652429017143,0.001877130859619,-1.20117328732592E-05
331,0.023962447589046,0.000783744066109,-5.8070352400634E-05
333,0.018774689471091,0.000995094936851,8.62074795878716E-05
335,0.014752548862422,0,2.92509632096186E-05
337,0.014958886941036,0.000185404924432,-9.57032072375844E-05
339,0.012394144187029,0.000740652113657,0.00017764055889
341,0.012759299449179,0.000854165160869,0.000144296865294
343,0.011727149403735,0.000634810880472,1.84897658379909E-05
344,0.010139053355062,0.000616401957477,-7.83779939163193E-05
346,0.009706204048347,9.16932924220119E-05,-2.58167375410989E-05
348,0.009871038508044,0.000601413097749,0
350,0.008436484650337,0.000424792538627,4.60010054651527E-06
352,0.009033532057967,0.000377407758088,-0.000141681567309
354,0.008774235573334,0.000458218412718,0.000107511540059
356,0.008187961656414,0.000328330746083,0.000126059018075
358,0.008969754488551,0.000409587769948,0.000140033408051
360,0.008058480940355,0.000358761587714,8.48494469371647E-05
361,0.008262433677781,0.000323538843194,7.92122556525253E-05
363,0.008883513257077,0.000261499193603,7.36264984072193E-05
365,0.008583652671079,5.37314958188603E-05,9.07703424277848E-05
367,0.007933782827642,3.92288618088702E-05,0.000150949647122
369,0.0083599703046,0.000330148941499,7.86544021815599E-05
371,0.007625151038636,0.000504537060344,2.77180705107142E-05
373,0.007609751392398,0.000154814140037,4.3588750228254E-05
375,0.008102587531666,0.000184267699671,3.24259735502857E-05
377,0.006830193940111,0.000300749692883,1.88172637075038E-05
378,0.007586606464687,0.000258800015938,-1.82166326200555E-05
380,0.007829213536438,0.000355525752516,0.00020903272804
382,0.007150524166826,0.000589483118832,0.000168833717492
384,0.006969854732538,0.000277387737408,3.0682144038024E-05
386,0.00725307449556,0.000406860414733,4.63669854230687E-05
388,0.007177300359715,0.00017107232696,4.01386081886016E-05
390,0.007306268097899,0.000299358924917,0.000189643744159
392,0.00715407329114,0.00037869362477,-3.38073618467696E-05
394,0.00767261335049,0.000182878206839,0.000141598430964
396,0.007905305193994,0.000235879510986,2.55435152158469E-05
397,0.007681781933545,0.000378677352297,7.61561689501631E-06
399,0.008163513104968,0.00017042903336,3.0306446569461E-05
401,0.008932594207072,0.000232140680482,5.02772706229019E-05
403,0.00986612732825,0.000115529693085,-5.0043082773168E-06
405,0.012382999583467,0.000300591738159,3.98273946754541E-05
407,0.015086662095653,0.000298759993925,7.4221302605833E-06
409,0.019930336002255,8.72254777114794E-05,-1.71911602675046E-05
411,0.025948490644586,0.000216138013274,-6.57232003679717E-05
412,0.035063812392145,0.000342197945845,6.02172901749315E-05
414,0.046636190719328,0.000135210038304,0.000157035080385
416,0.061155569489389,0.000216661076293,0.000201776131773
418,0.079532755924109,0.000270721057027,2.07880809386239E-05
420,0.101966834810595,0.000129025777059,0.000143041100435
422,0.129485694998177,0.000364170708858,-2.45190510257396E-05
424,0.163575539853505,0.00014752098767,5.02796028833067E-05
426,0.204815118443861,0.000159800174395,0.000119980253078
428,0.253606088203612,3.72778676910634E-05,6.71730130465047E-05
429,0.311730190115944,0.000270299616499,0.000125469258942
431,0.379616425342649,0.000186209314281,-1.00823518600395E-05
433,0.459419658563935,0.000238944367331,4.94676957933313E-05
435,0.55375930776982,0.000165730650986,2.91639702180225E-05
437,0.666584166697869,0.00021750279799,4.21018658509709E-05
439,0.803117911731976,0.000221231660063,-2.26505304319034E-05
441,0.965828651636363,0.000132554918077,0.000125027182708
443,1.15319785314428,0.000183931827251,8.32290926817228E-05
445,1.35719154216802,4.56962390751099E-05,9.9252160734384E-05
446,1.55349454072447,0.000240674452251,3.84601837843196E-05
448,1.71449333729555,0.000266436604918,6.58682806873892E-05
450,1.81067767959978,0.00013016542583,3.29838954642131E-05
452,1.82366759592733,0.000202517847709,1.83935434189165E-05
454,1.75614920208067,0.000124839570881,4.99489338620176E-05
456,1.63100020028987,0.000125768518276,8.94588628261249E-05
458,1.4828140416125,0.000140226160832,0.00012784461933
460,1.34344776715478,0.000121363658481,6.45444440067176E-05
461,1.22867642024159,0.00020436296924,4.60315907576227E-05
463,1.13805752355393,0.000172104698932,-1.93827998736302E-06
465,1.06240577765975,0.000257389632961,1.95863323242486E-06
467,0.991877191546168,0.00019675193338,4.15474204050633E-05
469,0.91935675753604,0.000212800976769,3.99435031042198E-06
471,0.846852225938424,0.000357712392037,1.20859007630589E-05
473,0.778818503777536,0.000338774461614,9.94426475331163E-05
475,0.721491550560355,0.000253863621687,9.59829464395871E-05
476,0.678996217756009,0.000306141442019,3.07842009029815E-05
478,0.651690504690083,0.000153609897093,9.47374143900477E-05
480,0.636996214397392,0.000285863925811,9.69965744742323E-05
482,0.632783106236584,0.000381378555802,8.05343811324791E-05
484,0.634988574821455,0.000278462816626,7.22130106869535E-05
486,0.642625794357624,0.000292461501804,7.41096918887191E-05
488,0.652426561379774,0.000196709668177,7.79487815090738E-05
490,0.667196178051683,0.000348039950911,8.98264694183144E-05
491,0.683999452516132,0.000273920459387,4.059145911069E-05
493,0.703573453588179,0.000315019050524,0.000120948137382
495,0.724166613077388,0.000142107945948,4.80135038820043E-05
497,0.745278252497482,0.000260754751854,-1.98424045529217E-06
499,0.764957598015478,0.000398260429408,0.000149509809023
501,0.783536178139662,0.000180066131975,5.65484203861566E-05
503,0.801225046519091,0.000219667603087,9.47056535449288E-05
504,0.819433229314782,0.000217771124886,0.000120713170875
506,0.836444230904579,4.72436214218725E-05,5.51070205793951E-05
508,0.852984022496284,0.000328152606884,8.29652540927212E-05
510,0.87044588464583,0.000152951970119,0.000110469666634
512,0.887241837206213,0.00019827761737,-1.86087083460681E-06
514,0.905506695443193,0.000157805415526,0.000101820949683
516,0.924575555708496,0.000209554106552,0.000127221080816
517,0.945383714583355,0.000169771516317,8.45693716415236E-05
519,0.966864558502127,0.000228157399612,9.17699110691945E-05
521,0.988737774240885,0.000130319367771,8.80610781984757E-05
523,1.01099132219397,0.00016302886784,5.14098489348763E-05
525,1.03189725701569,0.000248296919135,3.67943828034197E-06
527,1.05356917242256,0.000235964073575,5.53641238424316E-05
529,1.07238256192584,0.000269862062841,5.74491312164807E-05
530,1.09187584691711,0.000317565088041,3.91178161696196E-05
532,1.1091062728428,0.000246264101935,6.74630044122962E-05
534,1.12497470319133,0.000194326666447,0.000109427427293
536,1.13864723034112,0.000222772963734,8.55312558964669E-05
538,1.15140793307959,0.000231352237585,3.83167420526001E-05
540,1.16130377608861,0.000192126210683,4.44344914808885E-05
542,1.17025157148116,0.000263022562545,4.4823011976253E-05
543,1.17596314057182,0.000223486630517,9.04530454374687E-05
545,1.18090355962052,0.000176203775798,-1.98444466912294E-06
547,1.18424930270447,0.000362808230358,7.21063060672861E-05
549,1.18627748789254,0.000201065775273,-1.21309598202116E-05
551,1.18621962878655,0.000253718960006,-5.91897722047066E-05
553,1.18561204249981,0.00035860328329,6.38768759542429E-05
555,1.18396961344076,0.000295558387677,-2.91256164154626E-05
556,1.18268235837704,0.000179060865549,3.99123069717587E-05
558,1.18019293035365,0.000135619933104,5.93981398461101E-05
560,1.17680760848405,0.00017503090618,7.71353045308829E-05
562,1.17419051147053,0.000130697727425,1.0823130912632E-05
564,1.17167211876281,0.000186459085595,9.18724697158298E-05
566,1.16809803254611,0.000188487915917,1.10562046178391E-05
567,1.16528275247826,0.000293864076427,5.81409220775455E-05
569,1.16288671073641,0.000369634295062,-7.46607175237715E-05
571,1.159600562739,0.000398565556191,0.00011908877298
573,1.15770486456488,0.000584911121939,4.40705960301382E-05
575,1.1550585921967,0.000384034602448,-3.29082170871845E-05
577,1.15381444683012,0.000499468758987,7.38893427676966E-05
579,1.15279296738748,0.000446652230049,-2.4184101422686E-06
580,1.15151843212479,0.000601712188345,4.41952928018272E-05
582,1.1518685666082,0.000673257570737,-5.23782206254652E-05
584,1.15216723213689,0.000756333972059,0.000101404704928
586,1.15244635531926,0.000741657041663,1.54679638514254E-05
588,1.15356688425299,0.001108504089403,9.44183988665116E-05
590,1.15400049808841,0.001194510245423,5.33842471031407E-05
591,1.15284380744369,0.001534488254858,-5.43450800055844E-06
593,1.15312656221022,0.001925960070411,-6.08664091272581E-05
595,1.15215853578109,0.002261298158014,8.73322956063653E-05
597,1.14975205463951,0.002557226028526,0.000111872616154
599,1.1465865768772,0.002914668930899,9.63741684953827E-05
601,1.14190552667428,0.00383241497492,0.000160517894955
602,1.13567635440874,0.004640694138894,7.56141370285558E-05
604,1.12725207145752,0.005462738406248,0.00013534956633
606,1.11703632978719,0.006596820553692,0.000171978718138
608,1.09427787672835,0.007829730274136,0.000114354596048
610,1.05993821556404,0.009368655650702,-1.93481308452897E-05
611,1.0264518781903,0.011060316218415,-1.63555213464624E-05
613,1.0023015379843,0.013129834629245,0.000255292999753
615,0.978397087015493,0.015800954000456,0.000184668963857
617,0.954828849847565,0.01860593221238,0.000251398436751
619,0.933124588315231,0.022334093665579,0.000271313168099
621,0.909062670137964,0.026462927298488,0.000221997136745
622,0.886456765882695,0.031453264313433,0.000371034984781
624,0.862630695806542,0.037228426213599,0.000479977554715
626,0.842563181444218,0.044185919978469,0.000415996439406
628,0.818909595886168,0.051893195832132,0.0005154228899
630,0.793618457442628,0.061464366057887,0.000525722165895
631,0.768282094384386,0.072392044297071,0.000698720600097
633,0.741858020117533,0.084117785432318,0.000818564964672
635,0.715289474611703,0.098228792551488,0.000825904654904
637,0.689620759347034,0.113281017030429,0.000847740949359
639,0.664034720464885,0.131080867158323,0.000965406177958
641,0.639220751642182,0.15104046847992,0.001243046623573
642,0.614933409395515,0.173165772343072,0.001140420223217
644,0.592270434162211,0.199194769922605,0.00131695450347
646,0.570453293319689,0.228117642548808,0.001577957527798
648,0.548231684357208,0.260778060304821,0.00177060163923
650,0.529014177410757,0.296983773148701,0.00203066971558
651,0.508227010783529,0.335835595220468,0.002558151934136
653,0.489269823886347,0.376732599795985,0.002641411023651
655,0.47002941467089,0.418484075934949,0.003033492817517
657,0.450827730198962,0.457125811152407,0.003488988777774
659,0.433335652282632,0.488031382166679,0.003986947172215
660,0.415626855324733,0.502177041802221,0.004704662645906
662,0.396906023325248,0.496282542328868,0.00545321184667
664,0.378743845298209,0.469108267574731,0.006291654284544
666,0.361953269080686,0.425974042196383,0.007277926033494
668,0.344595641643487,0.372334437328951,0.008359715556471
669,0.32872654630013,0.314705096688226,0.009515830251414
671,0.312678665271523,0.257299588773668,0.010804985368219
673,0.296796054879566,0.204274398447083,0.012406380433711
675,0.282757886376303,0.158952622780162,0.014053283284442
677,0.268883015285775,0.121597192546148,0.016086955301644
678,0.254938436460562,0.092467278955788,0.018279749977856
680,0.24143669723532,0.070338039083027,0.020477564648514
682,0.229356498247913,0.053176278105884,0.023096551495054
684,0.216480643640103,0.04057689182716,0.025963800772775
686,0.205318634838429,0.031281016790792,0.029216926491422
687,0.194833389132957,0.024106789372742,0.033115294969729
689,0.183156653755538,0.019220352967295,0.037443306087074
691,0.172090798623776,0.01500058163217,0.042026004831827
693,0.162030132489227,0.011944516711749,0.046293362855947
694,0.15245700945871,0.009375867100335,0.051562901076944
696,0.142467976056089,0.007424182089079,0.057575971166594
698,0.13433348049436,0.00583620221149,0.063475599468228
700,0.126216107429575,0.004588000683266,0.070130944603411
702,0.116940042878391,0.003690576162407,0.077056197366869
703,0.108921461755205,0.002947035856575,0.084460473436588
705,0.101486921001279,0.002400062048285,0.092561831662605
707,0.095756700531086,0.002168260309974,0.101329849913774
709,0.087833236026287,0.00147370991811,0.110587173206496
711,0.083896865194838,0.001232406366247,0.12037863390245
712,0.07753135071574,0.00100744420359,0.130463238490977
714,0.072720448228416,0.000994101852218,0.140271149933286
716,0.067594271412864,0.000823663693083,0.149414318102951
718,0.061774254854382,0.000651195986119,0.158506879640664
719,0.058057166491406,0.000516253465766,0.167330323876488
721,0.054292191806317,0.000379612826449,0.175252767613751
723,0.049953127329452,0.000160814031015,0.182159261605503
725,0.045035118725762,0.000262910279852,0.187394089928232
726,0.041875480841532,8.13506661209297E-05,0.191947243883339
728,0.039457731874236,0.000224898009878,0.196577908588813
730,0.03619572841692,6.16237221710975E-05,0.200398147956918
732,0.031407233396078,0.000206181491591,0.202286267890364
734,0.029895757253792,-0.000310159292561,0.203460289386527
735,0.026869350482295,-0.000124263722517,0.202995250304651
737,0.02433488351374,0.000124291415007,0.201290742640852
739,0.021629707798054,-0.000558510574627,0.196657740367476
741,0.019699912295918,-0.000494932322551,0.190568088195747
742,0.017218819386774,-0.000123124156118,0.182818329043998
744,0.014734899433325,-0.000163061389451,0.173904399839446
746,0.014868333456677,-2.02064229637166E-05,0.163599400112679
748,0.012391448810113,-0.000559939214391,0.151291424202775
749,0.012244365478651,0.000197604599634,0.137194374030714
751,0.010952234325328,-3.90072620847265E-05,0.121655407132
753,0.01092546937036,-0.000384697554511,0.105335031145146
755,0.009550533379374,-0.000284548487424,0.089820886888526
756,0.007610920674612,-0.000655083542059,0.075136514905153
758,0.006446494683786,-0.000499373660123,0.061255312065504
760,0.006622217940195,-0.000348097610128,0.049427358292915
762,0.004936201284112,0.000218502703364,0.039634650618101
763,0.002697610783007,-0.000454279835442,0.031229265400447
765,0.001999884759355,-0.000291613771833,0.024898468367946
767,0.001423444316953,-0.000312420955571,0.019600402860983
769,0.000481044324433,-0.000167687083509,0.015638059830937
770,-0.000122536066933,-0.0003037497418,0.012411433441689
772,-0.002131343452252,-0.000155391229489,0.009734649309993
774,-0.001286620712791,-0.000299001795264,0.007750683591302
776,-0.002114654383768,0.000184286669769,0.006468566718708
777,-0.002986902979114,0.000210344147729,0.005128756943082
779,-0.004312505266943,-0.000193973522404,0.003980774481878
781,-0.004689410753941,4.40317887920738E-05,0.003533254994283
782,-0.006642038320301,-0.00029081640112,0.002475323051537
784,-0.005407071687786,-0.000407534994334,0.002639104184412
786,-0.0063435691937,0.000502828522675,0.001943425779906
788,-0.006414562069431,4.62232576945657E-05,0.001281918966441
789,-0.008545937117584,-2.36430588966032E-05,0.001065092776284
791,-0.008960835240038,-4.95818193904216E-05,0.001228482356885
52 changes: 52 additions & 0 deletions data/spectra/pretend_rgb.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
wavelength,Red,Green,Blue
300,0,0,0
310,0,0,0
320,0,0,0
330,0,0,0
340,0,0,0
350,0,0,0
360,0,0,0
370,0,0,0
380,0,0,0
390,0,0,1
400,0,0,10
410,0,0,100
420,0,0,1000
430,0,0,100
440,0,0,10
450,0,0,1
460,0,0,0
470,0,0,0
480,0,0,0
490,0,1,0
500,0,10,0
510,0,100,0
520,0,1000,0
530,0,10000,0
540,0,1000,0
550,0,100,0
560,0,1,0
570,0,0,0
580,0,0,0
590,0,0,0
600,0,0,0
610,0,0,0
620,0,0,0
630,0,0,0
640,10,0,0
650,100,0,0
660,1000,0,0
670,100,0,0
680,10,0,0
690,0,0,0
700,0,0,0
710,0,0,0
720,0,0,0
730,0,0,0
740,0,0,0
750,0,0,0
760,0,0,0
770,0,0,0
780,0,0,0
790,0,0,0
800,0,0,0
12 changes: 12 additions & 0 deletions dev-environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: solarcalc-dev
channels:
- conda-forge
dependencies:
- python=3.*
- scipy
- numpy
- pysolar
- python-dateutil
- pytz
- timezonefinder
- pandas
4 changes: 0 additions & 4 deletions docs/.buildinfo

This file was deleted.

Binary file removed docs/.doctrees/Solarpos.doctree
Binary file not shown.
Binary file removed docs/.doctrees/Spectra.doctree
Binary file not shown.
Binary file removed docs/.doctrees/ansible.doctree
Binary file not shown.
Binary file removed docs/.doctrees/environment.pickle
Binary file not shown.
Binary file removed docs/.doctrees/genindex.doctree
Binary file not shown.
Binary file removed docs/.doctrees/index.doctree
Binary file not shown.
Binary file removed docs/.doctrees/light_sim.doctree
Binary file not shown.
Binary file removed docs/.doctrees/py-modindex.doctree
Binary file not shown.
Binary file removed docs/.doctrees/world_temp_sim.doctree
Binary file not shown.
Empty file removed docs/.nojekyll
Empty file.
Loading