Differences

This shows you the differences between two versions of the page.


Previous revision
Next revision
api:estimate [2019/12/30 16:22] – [URL parameters] knutkohl
Line 1: Line 1:
 +Examples here use the ''estimate'' mode, you can replace it with ''history'' for historic data or with ''clearsky'' for theoretic results for clear sky weather.
 +
 +===== Solar production estimate =====
 +
 +Get solar production estimate for specific location (defined by **latitude** and **longitude**) and a specific plane orientation (defined by **declination** and **azimuth**) for an installed **module power**.
 +
 +===== Historic solar production =====
 +
 +''historic'' means here that the average of all years of the available weather data on that day is considered, the current weather is thus **not** included in the calculation.
 +
 +===== Clear sky solar production =====
 +
 +If there were no clouds it would be a clear sky. `clearsky` thus calculates the theoretically possible production.
 +
 +===== Public =====
 +
 +  * One plane can be accessed by an API call
 +  * only ''estimate'' data available
 +
 +  https://api.forecast.solar/estimate/:lat/:lon/:dec/:az/:kwp
 +
 +===== Personal =====
 +
 +  * One plane can be accessed by an API call
 +  * ''estimate'' and ''history'' data are available
 +
 +  https://api.forecast.solar/:apikey/estimate/:lat/:lon/:dec/:az/:kwp
 +
 +===== Professional =====
 +
 +  * Combined data of up to 3 planes can be accessed by one API call
 +  * ''estimate'', ''history'' and ''clearsky'' data are available
 +
 +  https://api.forecast.solar/:apikey/estimate/:lat/:lon/:dec/:az/:kwp
 +  https://api.forecast.solar/:apikey/estimate/:lat/:lon/:dec1/:az1/:kwp1/:dec2/:az2/:kwp2
 +  https://api.forecast.solar/:apikey/estimate/:lat/:lon/:dec1/:az1/:kwp1/:dec2/:az2/:kwp2/:dec3/:az3/:kwp3
 +
 +===== URL parameters =====
 +
 +  * **''apikey''** - personal **API key** for registered users
 +  * **''lat''** - **latitude** of location, ''-90'' (south) ... ''90'' (north)
 +  * **''lon''** - **longitude** of location, ''-180'' (west) ... ''180'' (east)
 +  * **''dec''** - plane **declination**, ''0'' (horizontal) ... ''90'' (vertical)
 +  * **''az ''**  - plane **azimuth**, ''-180'' ... ''180'' (-180 = north, -90 = east, 0 = south, 90 = west, 180 = north)
 +  * **''kwp''** - installed **modules power** in ''kilo watt''
 +
 +You can poke around with the [[http://swagger.forecast.solar/?url=https://api.forecast.solar/swagger.yaml|Swagger Editor]] to build proper request URLs.
 +===== Watts, Watt hours, Watt hours day =====
 +
 +There are also routes available to query only the watts, watt hours or watt hours per day.
 +
 +  https://api.forecast.solar/estimate/watts/:lat/:lon/:dec/:az/:kwp
 +  https://api.forecast.solar/estimate/watthours/:lat/:lon/:dec/:az/:kwp
 +  https://api.forecast.solar/estimate/watthours/day/:lat/:lon/:dec/:az/:kwp
 +
 +The same for Personal and Professional accounts with API key
 +
 +  https://api.forecast.solar/:apikey/estimate/watts/:lat/:lon/:dec/:az/:kwp
 +  https://api.forecast.solar/:apikey/estimate/watthours/:lat/:lon/:dec/:az/:kwp
 +  https://api.forecast.solar/:apikey/estimate/watthours/day/:lat/:lon/:dec/:az/:kwp
 +
 +Here you can query with a Professional account also up to 3 planes at once.
 +===== Example =====
 +
 +Get solar production estimate per day as [[:api#Response content type|CSV]] for 52° north, 12° east, for a installation with a declination of 37° looking south (0°) with 5.67 kWp
 +
 +<code bash>
 +curl -H "Accept: text/csv" https://api.forecast.solar/<APIkey>/estimate/watthours/day/52/12/37/0/5.67
 +</code>
 +
 +<code csv>
 +2016-02-08;3680
 +2016-02-09;13545
 +2016-02-10;8347
 +2016-02-11;3873
 +2016-02-12;18763
 +2016-02-13;4022
 +2016-02-14;4298
 +2016-02-15;3395
 +</code>
 +
 +Get solar production estimate as [[:api#Response content type|JSON]] for 52° north, 12° east, for a installation with a declination of 37° looking south (0°) with 5.67 kWp
 +
 +<code bash>
 +curl https://api.forecast.solar/<APIkey>/estimate/watthours/52/12/37/0/5.67
 +</code>
 +
 +<code json>
 +{
 +    "result": {
 +        "2016-02-08 07:20:00": 0,
 +        "2016-02-08 07:38:00": 17,
 +        "2016-02-08 08:15:00": 195,
 +        ...
 +        "2016-02-08 15:45:00": 3599,
 +        "2016-02-08 17:14:00": 3680,
 +        "2016-02-08 17:32:00": 3680,
 +        "2016-02-09 07:18:00": 0,
 +        "2016-02-09 07:36:00": 66,
 +        "2016-02-09 08:15:00": 785,
 +        ...
 +        "2016-02-09 15:45:00": 13472,
 +        "2016-02-09 17:16:00": 13545,
 +        "2016-02-09 17:34:00": 13545,
 +        "2016-02-10 07:17:00": 0,
 +        "2016-02-10 07:35:00": 26,
 +        "2016-02-10 08:15:00": 314,
 +        ...
 +        "2016-02-10 15:45:00": 8268,
 +        "2016-02-10 17:18:00": 8347,
 +        "2016-02-10 17:36:00": 8347,
 +        "2016-02-11 07:15:00": 0,
 +        "2016-02-11 07:33:00": 18,
 +        "2016-02-11 08:15:00": 231,
 +        ...
 +        "2016-02-11 15:45:00": 3791,
 +        "2016-02-11 17:20:00": 3873,
 +        "2016-02-11 17:38:00": 3873,
 +        "2016-02-12 07:13:00": 0,
 +        "2016-02-12 07:31:00": 97,
 +        "2016-02-12 08:15:00": 1284,
 +        ...
 +        "2016-02-12 15:45:00": 18674,
 +        "2016-02-12 17:22:00": 18763,
 +        "2016-02-12 17:39:00": 18763,
 +        "2016-02-13 07:11:00": 0,
 +        "2016-02-13 07:29:00": 19,
 +        "2016-02-13 08:15:00": 263,
 +        ...
 +        "2016-02-13 15:45:00": 3933,
 +        "2016-02-13 17:23:00": 4022,
 +        "2016-02-13 17:41:00": 4022,
 +        "2016-02-14 07:10:00": 0,
 +        "2016-02-14 07:27:00": 19,
 +        "2016-02-14 08:15:00": 282,
 +        ...
 +        "2016-02-14 15:45:00": 4169,
 +        "2016-02-14 17:25:00": 4298,
 +        "2016-02-14 17:43:00": 4298,
 +        "2016-02-15 07:08:00": 0,
 +        "2016-02-15 07:25:00": 20,
 +        "2016-02-15 08:15:00": 312,
 +        ...
 +    },
 +    "message": {
 +        "code": 0,
 +        "type": "success",
 +        "text": ""
 +    }
 +}
 +</code>
 +
 +The ''watt_hours'' data will **reset to 0 at day change**!