<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>oCoCarbon</title>
	<atom:link href="http://oco-carbon.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://oco-carbon.com</link>
	<description>do not covet your ideas</description>
	<lastBuildDate>Sat, 02 Mar 2013 11:57:49 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Convert HOBO U12 data logger dates to Excel serial dates</title>
		<link>http://oco-carbon.com/2013/02/06/convert-hobo-u12-data-logger-dates-to-excel-serial-dates/</link>
		<comments>http://oco-carbon.com/2013/02/06/convert-hobo-u12-data-logger-dates-to-excel-serial-dates/#comments</comments>
		<pubDate>Wed, 06 Feb 2013 12:41:20 +0000</pubDate>
		<dc:creator>Jamie Bull</dc:creator>
				<category><![CDATA[Building monitoring]]></category>
		<category><![CDATA[Coding]]></category>
		<category><![CDATA[conversion]]></category>
		<category><![CDATA[data loggers]]></category>
		<category><![CDATA[Excel]]></category>
		<category><![CDATA[Hobo]]></category>
		<category><![CDATA[HoboWare]]></category>
		<category><![CDATA[monitoring]]></category>
		<category><![CDATA[VBA]]></category>

		<guid isPermaLink="false">http://oco-carbon.com/?p=1219</guid>
		<description><![CDATA[The data loggers which I use when doing building performance evaluations are great (Onset HOBO U12-012), but they have one little quirk that makes working with the data really irritating &#8211; dates come out in a variety of formats when imported into Excel. It seems like it&#8217;s an actually an Excel problem. The data in [...]]]></description>
				<content:encoded><![CDATA[<p>The data loggers which I use when doing building performance evaluations are great (<a href="http://www.onsetcomp.com/products/data-loggers/u12-012" target="_blank">Onset HOBO U12-012</a>), but they have one little quirk that makes working with the data really irritating &#8211; dates come out in a variety of formats when imported into Excel.</p>
<p>It seems like it&#8217;s an actually an Excel problem. The data in the CSV file exported from the HoboWare software are stored in one format &#8211; <code>07/02/12 06:00:00 PM</code> &#8211; but the data in Excel are sometimes translated into Excel serial dates (which is what we want) and sometimes remain in this Hobo format.</p>
<p>There may be a quicker way of handling this foible, but (as ever) my first thought was to throw some VBA at it. Here&#8217;s the code for a UDF which will knock that data into shape.</p>
<pre>Option Explicit

Function HOBO_TO_SERIAL(HoboTime As String) As Date

    ' Fix the edge case for values at midnight where no time part is brought in
    If Not (InStr(HoboTime, ":") > 0) Then
        HoboTime = HoboTime &#038; " 00:00:00"
    End If
    
    ' Set up to produce the date value
    Dim dateVal As Date
    Dim dateArr As Variant
    dateArr = Split(Split(HoboTime)(0), "/")
    
    ' Set up to produce the time value
    Dim timeVal As Date
    Dim timeArr As Variant
    timeArr = Split(Split(HoboTime)(1), ":")
    
    ' Correct time hour values from 12 to 00 to make the maths work later
    If timeArr(0) = 12 Then timeArr(0) = "00"
    
    ' Parse the input into a date value part and a time value part
    If InStr(HoboTime, "AM") Then
        ' Put the date into the format "dd/mm/yyyy". This means adding "20" to the start of the year
        dateVal = DateValue(dateArr(0) &#038; "/" &#038; dateArr(1) &#038; "/" &#038; ("20" &#038; dateArr(2)))
        timeVal = TimeValue(timeArr(0) &#038; ":" &#038; timeArr(1) &#038; ":" &#038; timeArr(2))
    ElseIf InStr(HoboTime, "PM") Then
        ' Put the date into the format "dd/mm/yyyy". This means adding "20" to the start of the year
        dateVal = DateValue(dateArr(0) &#038; "/" &#038; dateArr(1) &#038; "/" &#038; ("20" &#038; dateArr(2)))
        ' Correct the time from 12 hr to 24 hour clock
        timeArr(0) = (CInt(timeArr(0)) + 12) Mod 24
        timeVal = TimeValue(timeArr(0) &#038; ":" &#038; timeArr(1) &#038; ":" &#038; timeArr(2))
    Else
        If Application.International(xlDateOrder) = 1 Then
            ' Switches the day and month for UK-style date users
            dateVal = DateValue(Format(HoboTime, "yyyy-dd-mm"))
        Else
            dateVal = DateValue(Format(HoboTime, "yyyy-mm-dd"))
        End If
        timeVal = TimeValue(Format(HoboTime, "hh:mm:ss"))
    End If
    
    ' Finally, add the two values together to get a complete Excel serial time
    HOBO_TO_SERIAL = dateVal + timeVal
End Function
</pre>
<p>As ever, hope this helps someone else out.</p>
]]></content:encoded>
			<wfw:commentRss>http://oco-carbon.com/2013/02/06/convert-hobo-u12-data-logger-dates-to-excel-serial-dates/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Visualising the wind</title>
		<link>http://oco-carbon.com/2013/01/10/visualising-the-wind/</link>
		<comments>http://oco-carbon.com/2013/01/10/visualising-the-wind/#comments</comments>
		<pubDate>Thu, 10 Jan 2013 10:24:59 +0000</pubDate>
		<dc:creator>Jamie Bull</dc:creator>
				<category><![CDATA[Weather]]></category>
		<category><![CDATA[Wind energy]]></category>
		<category><![CDATA[charts]]></category>
		<category><![CDATA[visualisation]]></category>
		<category><![CDATA[wind]]></category>
		<category><![CDATA[wind rose]]></category>
		<category><![CDATA[Wind turbines]]></category>

		<guid isPermaLink="false">http://oco-carbon.com/?p=1035</guid>
		<description><![CDATA[You can&#8217;t see the wind, but just like other intangible things you can visualise it using charts. This post introduces you to a couple of ways of visualising the wind resource for a particular location. It&#8217;s an important early step in deciding whether or not a wind turbine is a good idea. Wind rose charts [...]]]></description>
				<content:encoded><![CDATA[<p>You can&#8217;t see the wind, but just like other intangible things you can visualise it using charts. This post introduces you to a couple of ways of visualising the wind resource for a particular location. It&#8217;s an important early step in deciding <a href="http://oco-carbon.com/2010/05/20/siting-small-scale-wind-turbines/" title="Siting small scale wind turbines">whether or not a wind turbine is a good idea</a>.</p>
<h3> Wind rose charts</h3>
<p>Do you have a home weather station and you’d like to interpret the outputs? Are you writing a renewable energy report and want to add a graphic to represent the wind resource? A structural report and you’d like to visualise the wind loading?<br />
Then you might just need a wind rose.</p>
<p><a href="http://oco-carbon.com/2013/01/10/visualising-the-wind/windrose/" rel="attachment wp-att-1052"><img src="http://oco-carbon.com/wp-content/uploads/2013/01/windrose.jpg" alt="windrose" width="510" height="386" class="alignnone size-full wp-image-1052" /></a> </p>
<h3>Wind speeds chart</h3>
<p>And while you’re about it, why not add in a chart of wind speeds. This is sometimes called a Weibull chart because wind speeds tend to follow a Weibull distribution.</p>
<p><a href="http://oco-carbon.com/2013/01/10/visualising-the-wind/windspeeds/" rel="attachment wp-att-1053"><img src="http://oco-carbon.com/wp-content/uploads/2013/01/windspeeds.jpg" alt="windspeeds" width="512" height="286" class="alignnone size-full wp-image-1053" /></a></p>
<p>Knowing where the wind comes from and how fast it is can tell you a lot about whether the site is suitable for a wind turbine. The faster the average wind speed the better return you’ll generate. A common rule of thumb is that if the average wind speed is less than 5 meters per second then you won’t get much benefit from a wind turbine.</p>
<p>This post will take you through creating charts like these.</p>
<h3>1: Getting your wind data</h3>
<p>Obviously the most important part of creating your wind speed graphic is the data. How you get hold of this will vary depending on what you’re using it for. These are a few typical places you might find wind speed data to use:</p>
<h4>Weather stations</h4>
<p>All over the world weather stations are set up recording every passing gust of wind, floating cloud, drop of rain and ray of sunshine. You can download data from thousands of Weather Underground stations around the world using our <a href="http://oco-carbon.com/weather/access.html">Weather Access</a> web form.</p>
<h4>Energy modelling weather files</h4>
<p>You can often extract the data you need from the weather files used by building simulation engineers. These aren’t as well distributed across the world as weather stations, but they do represent a typical year rather than just a year chosen random so are likely to give a more accurate idea of wind conditions than a weather station. You can find your nearest weather files using the <a href="http://oco-carbon.com/2012/10/03/weather-file-finder/" title="Weather file finder">Weather File Finder</a> tool from this site.</p>
<h4>Your own weather station</h4>
<p>If you have your own personal weather station or anemometer then you will probably have a ready source of data. If not, you can get hold of one, through one of the links at <a href="http://www.wunderground.com/weatherstation/setup.asp" target="_blank">Weather Underground</a>, or through <a href="http://www.bettergeneration.co.uk/" target="_blank">Better Generation</a> who produce the Power Predictor which is specifically designed to assess renewable energy potential.</p>
<h3>2: Download and open the wind chart creator</h3>
<p>This is an easy step. The download link is <a href="http://oco-carbon.com/downloads/oCoWindCharts.zip">here</a>. Just save the file to your computer, unzip the zip file and open it up in Excel. </p>
<h3>3: Import the wind data</h3>
<p>This step depends on the source of your data.<br />
If it’s from our Weather Access page then you will probably have downloaded it in two six-month chunks. There’s a button on the front page of the wind charts maker to import them for you.</p>
<p>If it’s from an energy simulation weather file then the process may be a bit more involved. We&#8217;ll work towards making a simple import button like we have for Weather Access/Weather Underground data but for now you&#8217;ll probably have to wrangle the data yourself in Excel and paste it into the Windspeed m/sec column.</p>
<p>If it&#8217;s from your own weather station then the simplest route might be to join the Weather Underground network and import it from there, otherwise again it&#8217;s a case of formatting the data yourself in Excel and pasting it into the Wind Charts tool.</p>
<h3>4: Check your charts</h3>
<p>Your charts should now be ready in the Charts tab of the workbook. Just copy and paste them into your document and away you go!</p>
<p>This is a brand new tool so please do give us your feedback, either <a href="mailto:mail@oco-carbon.com?Subject=Wind%20Charts%20tool"> by email</a> or in the comments here.</p>
<h3>For lots more information on wind energy, wind turbines, and calculating the return you can expect in your location, <em><a href="http://www.amazon.co.uk/Small-Scale-Wind-Power-Generation-Practical/dp/1847972101">Small Scale Wind Power Generation: A Practical Guide</a></em> is available now!</h3>
]]></content:encoded>
			<wfw:commentRss>http://oco-carbon.com/2013/01/10/visualising-the-wind/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Regional settings in Excel &#8211; research</title>
		<link>http://oco-carbon.com/2013/01/08/regional-settings-in-excel-research/</link>
		<comments>http://oco-carbon.com/2013/01/08/regional-settings-in-excel-research/#comments</comments>
		<pubDate>Tue, 08 Jan 2013 17:06:53 +0000</pubDate>
		<dc:creator>Jamie Bull</dc:creator>
				<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://oco-carbon.com/?p=1048</guid>
		<description><![CDATA[Passing on a request from a couple of researchers trying to collect a comprehensive list of Excel versions and regional settings (things like decimal separators, types of brackets, etc.). If you have a couple of minutes spare and use Excel, head over to their site and download their workbook (the link is a bit awkward [...]]]></description>
				<content:encoded><![CDATA[<p>Passing on a request from a couple of researchers trying to collect a comprehensive list of Excel versions and regional settings (things like decimal separators, types of brackets, etc.). If you have a couple of minutes spare and use Excel, head over to <a href="https://sites.google.com/site/e90e50/vba/application-international-settings">their site</a> and download <a href="https://sites.google.com/site/e90e50/vba/application-international-settings/Test_Excel_Application_International.xls?attredirects=0&#038;d=1">their workbook</a> (the link is a bit awkward to find so I&#8217;ve linked it here too). When you click the button it writes the regional settings onto the worksheet then you can then save and email it back to them.</p>
<p>There&#8217;s a load of other weird and wonderful things knocking around on the site. Have a look in the Wet Bread section. I particularly like the look of <a href="https://sites.google.com/site/e90e50/random-topics/pong-con-excel-grafico-xy">Pong in Excel</a>!</p>
]]></content:encoded>
			<wfw:commentRss>http://oco-carbon.com/2013/01/08/regional-settings-in-excel-research/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Building Energy Performance Simulation Q&amp;A site</title>
		<link>http://oco-carbon.com/2013/01/08/building-energy-performance-simulation-qa-site/</link>
		<comments>http://oco-carbon.com/2013/01/08/building-energy-performance-simulation-qa-site/#comments</comments>
		<pubDate>Tue, 08 Jan 2013 15:27:34 +0000</pubDate>
		<dc:creator>Jamie Bull</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[building energy simulation]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[Embodied energy]]></category>
		<category><![CDATA[EnergyPlus]]></category>
		<category><![CDATA[Q&A]]></category>
		<category><![CDATA[simulation]]></category>
		<category><![CDATA[tools]]></category>

		<guid isPermaLink="false">http://oco-carbon.com/?p=1042</guid>
		<description><![CDATA[If there&#8217;s one single site on the internet that I couldn&#8217;t live without (perhaps with the exception of Google), it would be StackOverflow from StackExchange. It&#8217;s an absolute life-saver for programmers, and as a fairly recent convert to programming, I struggle to think what it must have been like in the days before it existed. [...]]]></description>
				<content:encoded><![CDATA[<p><a href="http://area51.stackexchange.com/proposals/45232/building-performance-simulation-analysis?referrer=NVZBFbJc8KFGNOQAQVJC6g2"><img src="http://area51.stackexchange.com/ads/proposal/45232.png" width="220" height="250" alt="Stack Exchange Q&#038;A site proposal: Building Performance Simulation &#038; Analysis" /></a></p>
<p>If there&#8217;s one single site on the internet that I couldn&#8217;t live without (perhaps with the exception of <a href="http://google.co.uk" target="_blank">Google</a>), it would be <a href="http://stackoverflow.com" target="_blank">StackOverflow</a> from <a href="http://stackexchange.com/" target="_blank">StackExchange</a>. It&#8217;s an absolute life-saver for programmers, and as a fairly recent convert to programming, I struggle to think what it must have been like in the days before it existed. It&#8217;s on a par with how people ever found information before Google.</p>
<p>The amount it increases a lone coder&#8217;s productivity is just staggering.</p>
<p>So when I see that there is a suggestion to create a StackExchange site for <a href="http://area51.stackexchange.com/proposals/45232/building-performance-simulation-analysis" target="_blank">building energy performance simulation</a> I can barely control my excitement. A place where researchers can share best practice, iron out little niggles in their models, show prospective employers that they know their stuff [1], and all the other good things that StackExchange brings to the coding community.</p>
<p>Apologies for the evangelising but this is a really great opportunity to make a difference to researchers&#8217; and engineers&#8217; day-to-day lives. Please do <a href="http://area51.stackexchange.com/proposals/45232/building-performance-simulation-analysis" target="_blank">head on over</a> and get involved. You can help move the fledgling site out of &#8220;Area 51&#8243; and on to the next stage of development before it can become a fully-developed StackExchange site.</p>
<p>Thanks to <a href="http://openrevit.com/2013/01/a-building-energy-performance-simulation-qa-site-that-will-change-your-life" target="_blank">Clayton Miller at OpenRevit</a> for the heads-up.</p>
<p>[1] Via the reputation system. Here&#8217;s my profile on StackOverflow. I look forward to adding building energy performance simulation to this badge.<br />
<a href="http://stackexchange.com/users/1887671"><br />
<img src="http://stackexchange.com/users/flair/1887671.png" width="208" height="58" alt="profile for Jamie Bull on Stack Exchange, a network of free, community-driven Q&amp;A sites" title="profile for Jamie Bull on Stack Exchange, a network of free, community-driven Q&amp;A sites"><br />
</a></p>
]]></content:encoded>
			<wfw:commentRss>http://oco-carbon.com/2013/01/08/building-energy-performance-simulation-qa-site/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Weather data from Weather Underground</title>
		<link>http://oco-carbon.com/2012/12/15/weather-data-from-weather-underground/</link>
		<comments>http://oco-carbon.com/2012/12/15/weather-data-from-weather-underground/#comments</comments>
		<pubDate>Sat, 15 Dec 2012 11:41:50 +0000</pubDate>
		<dc:creator>Jamie Bull</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Renewable energy]]></category>
		<category><![CDATA[Weather]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[CSV]]></category>
		<category><![CDATA[data]]></category>
		<category><![CDATA[weather]]></category>
		<category><![CDATA[weather files]]></category>
		<category><![CDATA[weather station]]></category>
		<category><![CDATA[Wind energy]]></category>
		<category><![CDATA[wunderground]]></category>

		<guid isPermaLink="false">http://oco-carbon.com/?p=995</guid>
		<description><![CDATA[Go straight to the web form. If you want to know how to design your building you to need to know what the local weather is like. If you want to understand how your building is performing you need to know what weather it was coping with. If you want to install renewable energy &#8211; [...]]]></description>
				<content:encoded><![CDATA[<p><a href="http://oco-carbon.com/weather/access.html" target="_blank">Go straight to the web form.</a></p>
<p>If you want to know how to design your building you to need to know what the local weather is like. If you want to understand how your building is performing you need to know what weather it was coping with. If you want to install renewable energy &#8211; solar panels, wind turbines &#8211; you need to know what kind of weather conditions you&#8217;ll be able to harness. <a href="http://www.wunderground.com/" target="_blank">Weather Underground</a> is a great source of free weather data, aggregating a multitude of independent weather stations all around the world.</p>
<p>I first needed to pull some data from Weather Underground after I found out that the weather station on a university campus down in Cornwall where I&#8217;m monitoring a building had been damaged during the construction of another building on the campus. And then I found out the same thing had happened to another building I&#8217;m monitoring down there. The problem was I needed months and months of data for two sites, but Weather Underground only seemed to serve up one day at a time. And so was born <code>wunderscraper.py</code>.</p>
<p>You can do some pretty cool things with weather data. This one plots temperature against heating energy use.</p>
<p><a href="http://oco-carbon.com/2012/12/15/weather-data-from-weather-underground/temperature-trace/" rel="attachment wp-att-1010"><img src="http://oco-carbon.com/wp-content/uploads/2012/12/Temperature-trace.jpg" alt="Temperature trace" width="646" height="417" class="alignnone size-full wp-image-1010" /></a></p>
<p>And this one plots the wind conditions for a location. Very useful if you&#8217;re considering installing a wind turbine. If you or someone you know are interested, <a href="http://www.amazon.co.uk/Small-Scale-Wind-Power-Generation-Practical/dp/1847972101" target="_blank">Small-Scale Wind Power: A Practical Guide</a> would make a great present &#8211; and it&#8217;s on offer this Christmas!</p>
<p><a href="http://oco-carbon.com/2012/12/15/weather-data-from-weather-underground/wind-data/" rel="attachment wp-att-1014"><img src="http://oco-carbon.com/wp-content/uploads/2012/12/Wind-data.jpg" alt="Wind data" width="474" height="716" class="alignnone size-full wp-image-1014" /></a></p>
<p>After that as a bit of a challenge to improve my non-VBA coding, I thought it might be a nice idea to try and put together a proper web-based API to simplify things a bit [1]. If it gets too much traffic I&#8217;ll have to take it down, hobble it, or password protect it &#8211; so be gentle!. I don&#8217;t want to take real business away from the Wunderground people, but I don&#8217;t think there&#8217;ll be enough traffic to this site to really worry them.</p>
<p>So, how does it work?</p>
<p>It&#8217;s really a very simple API. There are three URL parameters, <code>stationID</code>, <code>startdate</code> and <code>enddate</code>. Basically you build your URL as follows:</p>
<p><code>http://oco-carbon.com/weather/download.php?stationID=ICORNWAL14&#038;startdate=2012-10-09&#038;enddate=2012-10-10</code></p>
<p><a href="http://oco-carbon.com/weather/download.php?stationID=ICORNWAL14&#038;startdate=2012-10-09&#038;enddate=2012-10-10">Give it a try</a>.</p>
<p>That downloads you a CSV file containing all the data between the two dates specified. For this example the file will be called <code>ICORNWAL14_2012-10-09_2012-10-10</code>.</p>
<p>Since my site is currently hosted in the United States (<A href="http://www.ipage.com/join/index.bml?AffID=638054&amp;LinkName=Check out iPage">if you&#8217;re looking for hosting, check out my affiliate link</A> [2]), the resulting file comes back with temperatures in Farenheit, rainfall in inches, wind speeds in miles per hour, etc. by default. <del datetime="2012-12-19T14:51:20+00:00">I&#8217;ll add a parameter to specify whether you want imperial/US or metric data in the future but this will do for now.</del> For metric data just tick the checkbox option.</p>
<p>As well as the API, I&#8217;ve also put together a <a href="http://oco-carbon.com/weather/access.html" target="_blank">web form</a> that you can use to do the downloading if you&#8217;re not minded to use the API directly. It&#8217;s as easy as putting in the weather station ID which you can find from here, and the start and end date of the period you want.</p>
<p>Enjoy!</p>
<p>[1] I know, I know. They have a <a href="http://www.wunderground.com/weather/api/" target="_blank">proper API</a>. But in the words of a blog post I just read, <a href="http://blog.hartleybrody.com/web-scraping/" target="_blank">&#8220;I don&#8217;t need no stinking API&#8221;</a>, and I enjoyed the learning process.</p>
<p>[2] Disclosure: Apparently <a href="http://www.ipage.com/join/index.bml?AffID=638054" target="_blank">iPage</a> will pay me for referrals, but I&#8217;d recommend them anyway. My partner&#8217;s site, <a href="http://anothervoicetranslations.co.uk/" target="_blank">Another Voice Translations</a> is also hosted through <a href="http://www.ipage.com/join/index.bml?AffID=638054" target="_blank">iPage</a> on my recommendation and that was before I knew about the affiliate programme. They made making the transition from a WordPress blog to a self-hosted site really very simple, and adding the scripting that powers this API was also pretty easy. This site is independently owned and the opinions expressed here are my own.</p>
]]></content:encoded>
			<wfw:commentRss>http://oco-carbon.com/2012/12/15/weather-data-from-weather-underground/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Times and time zones in Excel &#8211; now with added Google</title>
		<link>http://oco-carbon.com/2012/11/19/times-and-time-zones-in-excel-now-with-added-google/</link>
		<comments>http://oco-carbon.com/2012/11/19/times-and-time-zones-in-excel-now-with-added-google/#comments</comments>
		<pubDate>Mon, 19 Nov 2012 12:30:48 +0000</pubDate>
		<dc:creator>Jamie Bull</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Maps]]></category>
		<category><![CDATA[Transport]]></category>
		<category><![CDATA[Excel]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[time]]></category>
		<category><![CDATA[time zones]]></category>
		<category><![CDATA[VBA]]></category>

		<guid isPermaLink="false">http://oco-carbon.com/?p=982</guid>
		<description><![CDATA[Max, a visitor here, recently left a comment asking about accessing the public transit travel time option in the Google Directions API. Up until then I hadn&#8217;t used it and assumed it worked the same as the walking and driving time options, but that turned out not to be the case. The key difference is [...]]]></description>
				<content:encoded><![CDATA[<p>Max, a visitor here, recently left a comment asking about accessing the public transit travel time option in the <a href="https://developers.google.com/maps/documentation/directions/" target="_blank">Google Directions API</a>. Up until then I hadn&#8217;t used it and assumed it worked the same as the <a href="http://oco-carbon.com/2012/05/17/a-google-maps-journey-time-function-for-excel/" title="A Google Maps journey time function for Excel" target="_blank">walking and driving time options</a>, but that turned out not to be the case.</p>
<p>The key difference is that you have to supply a time parameter as well as the start and end location. This can either be a departure or an arrival time.</p>
<p>The format required for the time parameter is seconds since midnight on 1/1/1970 (the start of the UNIX epoch), while Excel times are in days since midnight on 1/1/1900. This difference meant it seemed worth writing a function to do the conversions.</p>
<pre>
Function ExcelSerialToUnixEpoch(ExcelSerialTime As Date)
' Converts a date in Excel's date format to seconds since midnight 1/1/1970
Dim secondsPerDay As Double
Dim unixEpoch As Date
Dim excelEpoch As Date
Dim daysDifference As Long
    unixEpoch = #1/1/1970#
    excelEpoch = #1/1/1900#
    secondsPerDay = 86400
    daysDifference = DateDiff("d", excelEpoch, unixEpoch)
    ExcelSerialToUnixEpoch = (ExcelSerialTime - daysDifference) * secondsPerDay
End Function
</pre>
<pre>
Function UnixEpochToExcelSerial(UnixEpochTime As Double)
' Converts seconds since midnight 1/1/1970 to a date in Excel's date format
Dim secondsPerDay As Double
Dim unixEpoch As Date
Dim excelEpoch As Date
Dim daysDifference As Long
    unixEpoch = #1/1/1970#
    excelEpoch = #1/1/1900#
    secondsPerDay = 86400
    daysDifference = DateDiff("d", excelEpoch, unixEpoch)
    UnixEpochToExcelSerial = (UnixEpochTime / secondsPerDay) + daysDifference
End Function
</pre>
<p>So far so good. So what next?</p>
<p>A day of coding an interface for Google&#8217;s <a href="https://developers.google.com/maps/documentation/timezone/" target="_blank">experimental Time Zone API</a>, that&#8217;s what. This is because I can&#8217;t assume that everyone&#8217;s in the UK &#8211; Max is interested in public transport in Singapore for example.</p>
<p>The results are the following functions for your spreadsheeting delight. They&#8217;re also fine for VBA for Excel.</p>
<p><code>=LOCALTIME(Location As String)</code><br />
Returns the current local time for a given location, including daylight saving</p>
<p><code>=DST_OFFSET(Location As String)</code><br />
Returns any daylight saving time offset to the time at a given given location</p>
<p><code>=UTC_OFFSET(Location As String)</code><br />
Returns the time difference between UCT and the time at a given given location</p>
<p><code>=TIMEZONE_ID(Location As String)</code><br />
Returns the ID of the timezone for a given location</p>
<p><code>=TIMEZONE(Location As String)</code><br />
Returns the name of the timezone for a given location</p>
<p>These functions all ought to be pretty stable. They don&#8217;t cache results, obviously &#8211; since they&#8217;re to do with current time. But they do use recursion to keep extending a wait between repeated calls if you have reached Google&#8217;s soft limits for the API. These soft limits are where Google throttles the service if you appear to be accessing it too often in a short period of time. The module also includes a fallback to spot if you seem to have hit the hard limit for the day of 25,000 calls. In that case it will return the error message <code>OVER_HARD_QUERY_LIMIT</code>. If that happens then you need to go away for a while and try again the next day (or change your IP address if you&#8217;re feeling particularly sneaky).</p>
<p>You can <a href="http://oco-carbon.com/downloads/timezones.zip">download a workbook here</a> with all of these functions.</p>
<p>This was all something of a distraction from the main purpose of figuring out how to access travel times for public transport. That&#8217;s the next task on the horizon in the ever-expanding set of Google API interfaces for Excel that I&#8217;m building up here. It&#8217;s actually pretty simple, it just needs tidying up so if that&#8217;s what you&#8217;re waiting for, keep checking back here over the next week or so.</p>
]]></content:encoded>
			<wfw:commentRss>http://oco-carbon.com/2012/11/19/times-and-time-zones-in-excel-now-with-added-google/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Improved Excel interface for Google Geocoding API</title>
		<link>http://oco-carbon.com/2012/10/30/improved-excel-interface-for-google-geocoding-api/</link>
		<comments>http://oco-carbon.com/2012/10/30/improved-excel-interface-for-google-geocoding-api/#comments</comments>
		<pubDate>Tue, 30 Oct 2012 15:10:55 +0000</pubDate>
		<dc:creator>Jamie Bull</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Maps]]></category>
		<category><![CDATA[Transport]]></category>
		<category><![CDATA[Excel]]></category>
		<category><![CDATA[geocoding]]></category>
		<category><![CDATA[Gmaps]]></category>
		<category><![CDATA[Google API]]></category>
		<category><![CDATA[maps]]></category>
		<category><![CDATA[VBA]]></category>

		<guid isPermaLink="false">http://oco-carbon.com/?p=967</guid>
		<description><![CDATA[One quite popular post on this site is the Geocoding for Excel post. In common with lots of the code snippets here, the code was stripped down to the bare minimum to make it understandable and functional. I happened to be debugging a recent tool (the EPW weather file finder) and thought that it might [...]]]></description>
				<content:encoded><![CDATA[<p>One quite popular post on this site is the <a href="http://oco-carbon.com/2012/03/09/google-excel-geocoding/" title="Google geocoding for Excel">Geocoding for Excel</a> post. In common with lots of the code snippets here, the code was stripped down to the bare minimum to make it understandable and functional.</p>
<p>I happened to be debugging a recent tool (the <a href="http://oco-carbon.com/2012/10/03/weather-file-finder/" title="Weather file finder">EPW weather file finder</a>) and thought that it might be an idea to upload the finished version including features like results caching, error handling, URL encoding, and avoidance of localisation problems from the use of commas as decimal separators.</p>
<p>As before it returns latitude and longitude, but it now has three additional options for the return values and one to force the function to requery Google, for example if you think the value it has returned is incorrect.</p>
<p><code>=G_LATLNG("Trafalgar Square")</code> returns 51.5073346,-0.1276831<br />
<code>=G_LATLNG("Trafalgar Square",1)</code> also returns 51.5073346,-0.1276831<br />
<code>=G_LATLNG("Trafalgar Square",2)</code> returns 51.5073346<br />
<code>=G_LATLNG("Trafalgar Square",3)</code> returns -0.1276831<br />
<code>=G_LATLNG("Trafalgar Square",4)</code> returns Trafalgar Square, City of Westminster, London, UK</p>
<p>To force the function to requery you need to set the <code>Requery</code> option to <code>True</code> like so: <code>=G_LATLNG("Trafalgar Square",,True)</code> (note the two commas &#8211; you can also still use the number codes as the second parameter to return latitude, longitude or address).</p>
<p>There&#8217;s quite a lot of code in this function, but it&#8217;s well commented so should be reasonably easy to follow.</p>
<pre>
Function G_LATLNG( _
    InputLocation As Variant, _
    Optional n As Long = 1, _
    Optional Requery As Boolean = False _
    ) As Variant
' Requires a reference to Microsoft XML, v6.0
' The parameter 'n' refers to the type of reponse
' n = 1: Returns latitude, longitude as string
' n = 2: Returns latitude as double
' n = 3: Returns longitude as double
' n = 4: Returns address as string

' Updated 30/10/2012 to
'   - return an #N/A error if an error occurs
'   - cache only if necessary
'   - check for and attempt to correct cached errors
'   - work on systems with comma as decimal separator

Dim myRequest As XMLHTTP60
Dim myDomDoc As DOMDocument60
Dim addressNode As IXMLDOMNode
Dim latNode As IXMLDOMNode
Dim lngNode As IXMLDOMNode
Dim statusNode As IXMLDOMNode
Dim CachedFile As String
Dim NoCache As Boolean
Dim V() As Variant
    On Error GoTo exitRoute
    G_LATLNG = CVErr(xlErrNA) ' Return an #N/A error in the case of any errors
    ReDim V(1 To 4)
    
    ' Check and clean inputs
    If WorksheetFunction.IsNumber(InputLocation) _
        Or IsEmpty(InputLocation) _
        Or InputLocation = "" Then GoTo exitRoute
    InputLocation = URLEncode(CStr(InputLocation), True)
    
    ' Check for existence of cached file
    CachedFile = Environ("temp") &#038; "\" &#038; InputLocation &#038; "_LatLng.xml"
    NoCache = (Len(Dir(CachedFile)) = 0)
    
    Set myRequest = New XMLHTTP60
    
    If NoCache Or Requery Then ' if no cached file exists or if asked to requery then query Google
        ' Read the XML data from the Google Maps API
        myRequest.Open "GET", "http://maps.googleapis.com/maps/api/geocode/xml?address=" _
            &#038; InputLocation &#038; "&#038;sensor=false", False
        myRequest.Send
    Else ' otherwise query the cached file
        myRequest.Open "GET", CachedFile
        myRequest.Send
        Set myDomDoc = New DOMDocument60
        myDomDoc.LoadXML myRequest.responseText
        ' Get the status code of the cached XML file in case of previously cached errors
        Set statusNode = myDomDoc.SelectSingleNode("//status")
        If statusNode.Text <> "OK" Then
            Call G_LATLNG(InputLocation, n, True) ' Recursive way to try to remove cached errors
        End If
    End If
    
    ' Make the XML readable using XPath
    Set myDomDoc = New DOMDocument60
    myDomDoc.LoadXML myRequest.responseText
    
    ' If statusNode is "OK" then get the values to return
    Set statusNode = myDomDoc.SelectSingleNode("//status")
    If statusNode.Text = "OK" Then
        ' Get the location as returned by Google
        Set addressNode = myDomDoc.SelectSingleNode("//result/formatted_address")
        ' Get the latitude and longitude node values
        Set latNode = myDomDoc.SelectSingleNode("//result/geometry/location/lat")
        Set lngNode = myDomDoc.SelectSingleNode("//result/geometry/location/lng")
        V(1) = latNode.Text &#038; "," &#038; lngNode.Text
        V(2) = Val(latNode.Text) ' Fixed for systems with comma as decimal separator
        V(3) = Val(lngNode.Text) ' Fixed for systems with comma as decimal separator
        V(4) = addressNode.Text
        G_LATLNG = V(n)
        If NoCache Then: Call CreateFile(CachedFile, myRequest.responseText) ' Cache API response if required
    End If

exitRoute:
    ' Tidy up
    Set latNode = Nothing
    Set lngNode = Nothing
    Set myDomDoc = Nothing
    Set myRequest = Nothing
End Function
</pre>
<p>This depends on the following functions:</p>
<pre>
Public Function URLEncode( _
   StringVal As String, _
   Optional SpaceAsPlus As Boolean = False _
) As String
' Function from http://www.tinyguru.com/error/qid218181.html
Dim StringLen As Long: StringLen = Len(StringVal)
Dim i As Long, CharCode As Integer
Dim Char As String, Space As String

    If StringLen > 0 Then
        ReDim result(StringLen) As String

    If SpaceAsPlus Then Space = "+" Else Space = "%20"

        For i = 1 To StringLen
            Char = Mid$(StringVal, i, 1)
            CharCode = Asc(Char)
            Select Case CharCode
                Case 97 To 122, 65 To 90, 48 To 57, _
                    45, 46, 61, 95, 123, 125, 126
                    result(i) = Char
                Case 32
                    result(i) = Space
                Case 0 To 15
                    result(i) = "%0" &#038; Hex(CharCode)
                Case Else
                    result(i) = "%" &#038; Hex(CharCode)
            End Select
        Next i
        URLEncode = Join(result, "")
    End If
End Function
</pre>
<pre>
Function CreateFile(fileName As String, Contents As String) As String
' Function from http://www.jpsoftwaretech.com/vba/create-new-text-documents-using-vba/
' creates file from string contents
Dim tempFile As String
Dim nextFileNum As Long
  nextFileNum = FreeFile
  tempFile = fileName
  Open tempFile For Output As #nextFileNum
  Print #nextFileNum, Contents
  Close #nextFileNum
  CreateFile = tempFile
End Function
</pre>
]]></content:encoded>
			<wfw:commentRss>http://oco-carbon.com/2012/10/30/improved-excel-interface-for-google-geocoding-api/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Implementing the Normal Equation in Excel VBA</title>
		<link>http://oco-carbon.com/2012/10/25/implementing-the-normal-equation-in-excel-vba/</link>
		<comments>http://oco-carbon.com/2012/10/25/implementing-the-normal-equation-in-excel-vba/#comments</comments>
		<pubDate>Thu, 25 Oct 2012 17:18:02 +0000</pubDate>
		<dc:creator>Jamie Bull</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Excel]]></category>
		<category><![CDATA[machine learning]]></category>
		<category><![CDATA[regression analysis]]></category>
		<category><![CDATA[VBA]]></category>

		<guid isPermaLink="false">http://oco-carbon.com/?p=952</guid>
		<description><![CDATA[There&#8217;s a difficult-to-Google, but extremely useful equation for linear regression called the Normal Equation. I used to have an implementation in VBA and somehow lost is. As it happened, I needed it today so I spent a little while recreating it. This isn&#8217;t what I actually need the equation for, just a test case for [...]]]></description>
				<content:encoded><![CDATA[<p>There&#8217;s a difficult-to-Google, but extremely useful equation for linear regression called the Normal Equation. I used to have an implementation in VBA and somehow lost is. As it happened, I needed it today so I spent a little while recreating it.</p>
<p><a href="http://oco-carbon.com/wp-content/uploads/2012/10/Abalone-rings.jpg"><img src="http://oco-carbon.com/wp-content/uploads/2012/10/Abalone-rings.jpg" alt="" title="Abalone rings" width="600" height="400" class="alignnone size-full wp-image-953" /></a></p>
<p>This isn&#8217;t what I actually need the equation for, just a test case for making sure the equation works. If you want to try this out yourself, the data is the <a href="http://archive.ics.uci.edu/ml/datasets/Abalone" target="_blank"><code>abalone data set</code></a> from UCI. It&#8217;s a fairly simple data set which collates a whole load of data about abalone, along with the number of rings they have in their shells &#8211; an indicator of age, like tree rings.</p>
<p>The regression model I built is a simple one, with all the features as predictive variables and the ring count as the independent variable. </p>
<p>Here&#8217;s the code:</p>
<pre>
Function NormalEquation(X As Variant, y As Variant, Transpose As Boolean)
' theta = (X’ * X)^-1 * (X’ * y)
' Where n is the number of cases you have and k is the number of features:
'   X is an n rows x k columns array
'   y is an n rows x 1 column array
Dim XTy As Variant
Dim XTX As Variant
Dim theta As Variant
    XTX = Application.MMult(Application.Transpose(X), X)
    XTy = Application.MMult(Application.Transpose(X), y)
    NormalEquation = Application.MMult(Application.MInverse(XTX), XTy)
    If Transpose Then NormalEquation = Application.Transpose(NormalEquation)
End Function
</pre>
<p>To use it, set up the data, set up named ranges for <code>X</code>, <code>y</code> and <code>theta </code>(<code>theta </code>should be a 1D array of length k). In the picture below, <code>X</code> is red, <code>y</code> is orange and <code>theta</code> is blue.</p>
<p><a href="http://oco-carbon.com/wp-content/uploads/2012/10/Abalone-rings-sheet1.jpg"><img src="http://oco-carbon.com/wp-content/uploads/2012/10/Abalone-rings-sheet1.jpg" alt="" title="Abalone rings sheet" width="600" height="308" class="alignnone size-full wp-image-961" /></a></p>
<p>Use this code to call the function:</p>
<pre>
Sub TestNormalEquation()
Dim X As Variant
Dim y As Variant
Dim theta As Variant
    X = Range("X").Value2
    y = Range("Y").Value2
    theta = NormalEquation(X, y, True)
    Range("theta") = theta
End Sub
</pre>
<p>To use the results, the simplest way is to enter <code>=ROUND(SUMPRODUCT(theta,C3:K3),0)</code> in cell <code>M3</code> and fill down to the bottom of the data.</p>
<p>There you have it, a really powerful linear regression function ready for anything you want to throw at it.</p>
]]></content:encoded>
			<wfw:commentRss>http://oco-carbon.com/2012/10/25/implementing-the-normal-equation-in-excel-vba/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Excel macro for subscripts, superscripts and common typos</title>
		<link>http://oco-carbon.com/2012/10/24/excel-macro-for-subscripts-superscripts-and-common-typos/</link>
		<comments>http://oco-carbon.com/2012/10/24/excel-macro-for-subscripts-superscripts-and-common-typos/#comments</comments>
		<pubDate>Wed, 24 Oct 2012 21:13:01 +0000</pubDate>
		<dc:creator>Jamie Bull</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Excel]]></category>
		<category><![CDATA[formatting]]></category>
		<category><![CDATA[VBA]]></category>

		<guid isPermaLink="false">http://oco-carbon.com/?p=933</guid>
		<description><![CDATA[If you’re anything like me, seeing badly-formatted things like “12 m3” for “12 m3”, typos like “34 kgC02” for “34 kgCO2”– or worse, combinations like “100 KWh/m2” for “100 kWh/m2” – really rubs you up the wrong way. If it doesn’t then trust me, anyone copy editing, and many people just reading your work really [...]]]></description>
				<content:encoded><![CDATA[<p>If you’re anything like me, seeing badly-formatted things like “12 m3” for “12 m<sup>3</sup>”, typos like “34 kgC0<sub>2</sub>” for “34 kgCO<sub>2</sub>”– or worse, combinations like “100 KWh/m2” for “100 kWh/m<sup>2</sup>” – really rubs you up the wrong way. If it doesn’t then trust me, anyone copy editing, and many people just reading your work really hate you!</p>
<p>It’s more of an issue in documents than spreadsheets. People seem to hold Excel documents to a lower standard than those in Word, but it still nags at me when I see table headings with these annoying little errors.</p>
<p>So this is something I&#8217;ve been meaning to write for literally years, and only just got around to completing. You may have seen my post on subscript and superscript formatting for common things like CO<sub>2</sub>, m<sup>2</sup>, m<sup>3</sup>, H<sub>2</sub>O and so on in Word. If not, <a href="http://oco-carbon.com/2011/09/09/ms-word-macro-for-subscriptsuperscript-formatting/" title="MS Word macro for subscript/superscript formatting" target="_blank">here it is</a>.</p>
<p>And here&#8217;s the same thing for Excel. The macro corrects:</p>
<p>m2 to m<sup>2</sup><br />
m3 to m<sup>3</sup><br />
H2O, H20 to H<sub>2</sub>O<br />
C02, CO2 to CO<sub>2</sub><br />
kwh, KWH, KWh	to kWh<br />
KG, Kg	to kg</p>
<p>It works on protected worksheets in your workbook, so long as they are not password protected.</p>
<p>You&#8217;re welcome!</p>
<pre>
Sub FixFormatting()
'Exit Sub
' To fix m2, m3, CO2, kWh and kg to their proper states.
Dim c As Range
Dim StartCells As Range
Dim ws As Worksheet
Dim intPlace As Integer
Dim wsStartsProtected As Boolean

    Application.ScreenUpdating = False
    On Error GoTo errorCatch
    Set StartCells = Selection
    For Each ws In Application.Worksheets
        wsStartsProtected = ws.ProtectContents
        With ws
            .Visible = True
            .Activate
            .Unprotect
            .UsedRange.Select
        End With
        For Each c In ws.UsedRange
            With c
                .Replace What:="C02", Replacement:="CO2", LookAt:=xlPart, MatchCase:=False
                .Replace What:="H20", Replacement:="H2O", LookAt:=xlPart, MatchCase:=False
                .Replace What:="kwh", Replacement:="kWh", LookAt:=xlPart, MatchCase:=False
                .Replace What:="mwh", Replacement:="MWh", LookAt:=xlPart, MatchCase:=False
                .Replace What:="gwh", Replacement:="GWh", LookAt:=xlPart, MatchCase:=False
                .Replace What:="kg", Replacement:="kg", LookAt:=xlPart, MatchCase:=False
            End With
            intPlace = InStr(c.Value, "CO2")
            If intPlace > 0 Then
                If ActiveSheet.ProtectContents = True Then ActiveSheet.Unprotect
                c.Characters(intPlace + 2, 1).Font.Subscript = True
            End If
            intPlace = InStr(c.Value, "H2O")
            If intPlace > 0 Then
                If ActiveSheet.ProtectContents = True Then ActiveSheet.Unprotect
                c.Characters(intPlace + 1, 1).Font.Subscript = True
            End If
            intPlace = InStr(c.Value, "m2")
            If intPlace > 0 Then
                If ActiveSheet.ProtectContents = True Then ActiveSheet.Unprotect
                c.Characters(intPlace + 1, 1).Font.Superscript = True
            End If
            intPlace = InStr(c.Value, "m3")
            If intPlace > 0 Then
                If ActiveSheet.ProtectContents = True Then ActiveSheet.Unprotect
                c.Characters(intPlace + 1, 1).Font.Superscript = True
            End If
            If wsStartsProtected Then ws.Protect
        Next
    Next
    StartCells.Parent.Activate
    StartCells.Select
    Application.ScreenUpdating = True
    Exit Sub

errorCatch:
    If wsStartsProtected Then ws.Protect
    StartCells.Parent.Activate
    StartCells.Select
    Application.ScreenUpdating = True
End Sub
</pre>
]]></content:encoded>
			<wfw:commentRss>http://oco-carbon.com/2012/10/24/excel-macro-for-subscripts-superscripts-and-common-typos/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Weather file finder</title>
		<link>http://oco-carbon.com/2012/10/03/weather-file-finder/</link>
		<comments>http://oco-carbon.com/2012/10/03/weather-file-finder/#comments</comments>
		<pubDate>Wed, 03 Oct 2012 11:02:03 +0000</pubDate>
		<dc:creator>Jamie Bull</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[EnergyPlus]]></category>
		<category><![CDATA[Maps]]></category>
		<category><![CDATA[Weather]]></category>
		<category><![CDATA[.epw files]]></category>
		<category><![CDATA[Climate Consultant]]></category>
		<category><![CDATA[DesignBuilder]]></category>
		<category><![CDATA[Excel]]></category>
		<category><![CDATA[IES]]></category>
		<category><![CDATA[TAS]]></category>
		<category><![CDATA[Weather File Finder]]></category>
		<category><![CDATA[weather files]]></category>

		<guid isPermaLink="false">http://oco-carbon.com/?p=886</guid>
		<description><![CDATA[This tool was updated to v1.02 on 2/11/2012 * Ever had the problem of looking at all the weather files available from the EnergyPlus weather files site and wondering which is closest to the location you&#8217;re modelling in? The oCo Carbon Weather file finder will save you the trouble of looking them up, downloading them, [...]]]></description>
				<content:encoded><![CDATA[<p><strong>This tool was updated to v1.02 on 2/11/2012 *</strong></p>
<p>Ever had the problem of looking at all the weather files available from the <a href="http://apps1.eere.energy.gov/buildings/energyplus/weatherdata_about.cfm" target="_blank">EnergyPlus weather files site</a> and wondering which is closest to the location you&#8217;re modelling in? The <a href="http://oco-carbon.com/downloads/weather_file_finder.zip" target="_blank">oCo Carbon Weather file finder</a> will save you the trouble of looking them up, downloading them, opening up the statistics file to check their suitability, and once you&#8217;ve found the right site it also has links to download the file or files you need.</p>
<p><a href="http://oco-carbon.com/wp-content/uploads/2012/10/EPW_finder2.jpg"><img src="http://oco-carbon.com/wp-content/uploads/2012/10/EPW_finder2-1024x628.jpg" alt="" title="EPW_finder2" width="640" height="392" class="alignnone size-large wp-image-922" /></a></p>
<p>Each white dot on the map is the location of a weather file. You can see how hard it can be to pick the nearest one if you don&#8217;t happen to know the name of your local weather stations.</p>
<p>For use in building energy simulations .epw files can be read by EnergyPlus, as well as DesignBuilder and other tools which use EnergyPlus as the simulation engine, IES:VE. They can also be converted by TAS using their <a href="http://edsl.myzen.co.uk/tutorials/macros/6_Weather_Utility.htm" target="_blank">Weather Utility</a> macro. They can also be used for other purposes such as understanding the influence of local climate on building design using Climate Consultant <a href="http://www.energy-design-tools.aud.ucla.edu/tools/Climate54b3.exe" target="_blank">[Windows]</a> <a href="http://www.energy-design-tools.aud.ucla.edu/tools/Climate%20Consultant%205.4%20(B3).dmg" target="_blank">[Mac]</a>.</p>
<p>The weather file finder tool looks up the latitude and longitude of an entered location. You can enter anything from a postcode/zipcode to a country name, or even a latitude/longitude pair if you know them. It then calculates the great circle distance to each weather file location (taken from the first line of each weather file on the <a href="http://apps1.eere.energy.gov/buildings/energyplus/weatherdata_about.cfm" target="_blank">US Department of Energy website</a>) and creates links to download zip archive containing the .epw weather files for the closest three locations.</p>
<p>The tool also tells you the difference in latitude, longitude and elevation between the two sites which can help you to see whether the two locations are likely to be similar. Locations which have a large difference in elevation or latitude are likely to have quite different weather.</p>
<p>Finally, it lists a number of key statistics about the location including heating and cooling degree days, extreme temperature conditions and climate classification zone.</p>
<p>This tool can save you a lot of time, especially if you&#8217;re somewhere with a lot of nearby weather file locations (Poland, I&#8217;m looking at you here).</p>
<p><a href="http://oco-carbon.com/downloads/weather_file_finder.zip" target="_blank">Download oCo Carbon Weather File Finder v 1.02 here</a>.</p>
<p>* With particular thanks to Luke McGuire, Max Tillberg and Patrick Bivona for their useful comments and feedback.</p>
]]></content:encoded>
			<wfw:commentRss>http://oco-carbon.com/2012/10/03/weather-file-finder/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
