Charts Definition Language (CDL): Difference between revisions

From Cumulus Wiki
Jump to navigationJump to search
m
 
(13 intermediate revisions by the same user not shown)
INFO " <free text> "
 
CHART […] ENDCHART [OUTPUT] [INFO] blocks repeated
 
Plot blocks can be repeated as many times as you wish but different parameters can result in many yAxis (making the plot area smaller) and the chart may become crowded and unreadable. Experiment and try-out.
#ZOOM (Optional construct): Indicates which range selector button is the default when the chart is displayed; Defaults depend on chart range.
#PLOT: Starts the plot specification using one of the possible variables. Each chart requires at least one PLOT.
#[[CDL - STATS|STATS]]: Starts the statistics block using one of the possible variables. Semantics demands the variable to be plotted normally as well. IF a STATS of an equation plot is to be requested, the PLOT statement of the equation must precede the STATS statement.
#RECENT: Defines the variable to be governed by the CMX parameter ''GraphHours'' and are similar to the CMX RECENT graphs (though not equal).
#ALL: Defines the variable to be taken from the [[Dayfile.txt|Dayfile]] and all data for that variable will be plotted (Note that the CMX parameter ''ChartMaxDays'' will not be used)
#OUTPUT (Optional construct): Gives an optional name of an outputfile which starts at the chart where it is defined. Any chart after this OUTPUT specifier goes to this OUTPUT until another OUTPUT is found. Only the first OUTPUT specifier (implicitly: cumuluscharts.txt) accepts click events as defined by CONNECTSTO.
#INFO (Optional construct): Introduces a helptext section for the chart. The free text is enclosed in double quotes and cannot contain double quotes. The double quotes are delimited by a space character.
#PERIOD: Only in the context of the STATS function SMA. Gives the period of that specific running average
 
 
 
NOTE: The RECENT qualifier is optional as it is the default for a chart.<br/>
NOTE: The zoom buttons for the RECENT represent chart <math>1/4</math> and <math>1/2</math> the value of the hours specified in the CMX parameter ''GraphHours''.
 
===== With the ALL/DAILY qualifier =====
"MinBarometer", "MaxBarometer",
"MinHumidity", "MaxHumidity",
"HeatingDegreeDays","CoolingDegreeDays","DayEVT",
"Snow24h", "SnowDepth"
 
Note: The difference between ALL and DAILY is only between the displayed datarange (6 months or 1 month)
"AirQualityAvg1","AirQualityAvg2","AirQualityAvg3","AirQualityAvg4",
"UserTemp1","UserTemp2","UserTemp3","UserTemp4","UserTemp5","UserTemp6","UserTemp7","UserTemp8",
"LeafWetness1","LeafWetness2","LeafWetness3","LeafWetness4","LeafWetness5","LeafWetness6","LeafWetness7","LeafWetness8",
"LeafTemp1","LeafTemp2","LeafWetness1","LeafWetness2",
"LaserDist1","LaserDist2","LaserDist3","LaserDist4","LaserDepth1","LaserDepth2","LaserDepth3","LaserDepth4",
"CO2", "CO2_24h", "CO2_pm2p5", "CO2_pm2p5_24h","CO2_pm10","CO2_pm10_24h","CO2_temp","CO2_hum"
 
===== Axis Types =====
The following Axis are possible.
Temp, Wind, Distance, Height, Hours, Solar, UV, Rain, Rrate, Pressure, Humidity, DegreeDays, EVT, AQ, ppm, Free
 
Temp, Pressure, Rain, Rrate, Wind, Direction, Humidity, Solar, UV, Hours, Distance, Height, DegreeDays, EVT, Free, AQ, ppm, SoilMoisture
 
 
This only has meaning if there is an [[CDL - EVAL|EVAL]] with a valid expression present. As an [[CDL - EVAL|EVAL]] may modify the value of the plot variable to something completely different, the original Axis belonging to that plot variable may be useless or scale wrongly. Therefore you can choose your own Axis. If there is no valid equation, a warning is given and no axis is generated.
== The Chart Axis ==
All PlotVariables have their own defined axis and those axis will be coupled automatically to the chart. Multiple axis will be alternately added left-right where the order in the definition files determines this order. So it is the user who ultimately can define where the axis are placed: left or right and from inside to the outside in the order where they are encountered during the parsing process.
 
The scaling of the axis is flexible i.e. it starts with a reasonable value for the upper and lower bounds and adjusts if the real values are higher or lower. For some axis the lower bound is always 0 (e.g. rain) for another the upper and lower bounds are fixed. Specifics are found below.
 
The following axis are currently defined and implicit for the plot variables (the user has no options here):
#'''None'''
#'''Temp''' - automatic scaling for min/max
#Temp
#'''Pressure''' - scaling with a pseudo-fixed scale which means the min/max values of the scale are set to the min/max all time records found in ''alltime.ini''. Highcharts itself sets the scale values such that there is a tick at the end of the scale and the min/max values fall between the ticks at the end of the scale. If the pressure gets a lower/higher value the axis will adjust automatically. The idea is that any barometer you have at home has a fixed scale and with small variations there is little movement of the needle. However when the pressure starts falling/rising significantly it is very obvious. This behaviour is mimicked by CUtils (as far as possible)
#Pressure
#'''Rain''' - automatic scaling with minimum value of 0 and an initial maximum of 1 (to accommodate measurement in inches)
#Rain
#'''Rrate''' - automatic scaling with minimum value of 0 and an initial maximum of 1 (to accommodate measurement in inches)
#Rrate
#'''Wind''' - automatic scaling for min/max
#Wind
#'''Direction''' - scaling is fixed for 0 to 360 degree. When only direction is plotted two axis are created: in degrees and in wind directions (N, E, S, W). When combined with another unit only the axis with wind directions is used.
#Direction
#'''Humidity''' - scaling is fixed between 0 and 100
#Humidity
#'''Solar''' - scaling is fixed between 0 and a rough estimate of the maximum theoretical value for radiation + 50 to give the scale some space. If the actual value goes beyond that, the scale will adjust.
#Solar
#'''UV''' - automatic scaling for maximum, minimum is 0
#UV
#'''Hours''' - automatic scaling for maximum, minimum is 0
#Hours
#'''Distance''' - automatic scaling for maximum, minimum is 0
#Distance
#'''Height''' - automatic scaling for maximum, minimum is 0, basically used for the Cloudbase
#DegreeDays
#'''DegreeDays''' - automatic scaling for maximum, minimum is 0
#EVT
#'''EVT''' - automatic scaling for maximum, minimum is 0
#Free (has no title, unit or context associated with it. It just displays values)
#'''Free''' - has no title, unit or context associated with it. It just displays values. Automatic scaling for min/max.
#AQ
#'''AQ''' - automatic scaling for maximum, minimum is 0
#ppm
#'''ppm''' - automatic scaling for maximum which starts at 500, minimum is 0. The default maximum is because the CO<sub>2</sub> value is around 420 (in 2022) outdoors.
#'''SoiMoisture''' - automatic selection of the unit. '''cb''' (centibar) for a Davis soilmoisture sensor or '''%''' for an Ecowitt soilmoisture sensor and automatic scaling 0 - 200 (cb) and 0 - 100 for %
 
Translations for the axis titles come from the [Website] section (until '''''EVT''''') and should require no additional effort.
 
== Example CutilsCharts.def ==
The Chart definitions below isare included in the distribution of CumulusUtils andfor servesdirect use and asare annamed example''CutilsCharts-default-for-use.def''.
Rename this file to ''CutilsCharts.def'' and move it to the utils directory.
 
<pre style="height: 700px; overflow:scroll; width:auto;" >
;
; ChartsCompiler Demo and test chart definitions - Part of CumulusUtils
;
; This file is part of the distribution. Users may modify this file up to the indicator line
; © Copyright 2019 - 2021 Hans Rottier <hans.rottier@gmail.com>
; Anything beyond that line will be removed at generation time (by the ExtraSensors module)
;
; The first set goes to cumuluscharts.txt and is seen as standard charts and obligatory
;
; These charts may be modified and charts may be added.
; Author: Hans Rottier <hans.rottier@gmail.com>
; cumuluscharts.txt is userdefinable but must be present.
; Project: CumulusUtils meteo-wagenborgen.nl
;
; Date: 04-08-2021
; The user can create multiple output files. Checkout the Wiki for this.
;
; The bottom part, below the Demarcation line: ExtraSensorCharts and CustomLogsSensorCharts
; is filled in by CumulusUtils and will be replaced every run so don't modify
; unless you set the right to modify through the parameter 'UserModificationExtraSensorCharts' or 'UserModificationCustomLogsCharts' (see Wiki)
;
 
Chart Overview Title Overview of the current weather status
Equations
ConnectsTo 2 4 15 20
; Water Vapour Saturation Pressure according to the August-Roche-Magnus equation for the 1980 version, the 2008 version and the sub-zero version
Has WindBarbs Above colour black
Psat2008 EVAL [ 6.112 * EXP(17.62*Temperature/(243.12+Temperature)) ]
Zoom 3
Psat2008ALL EVAL [ 6.112 * EXP(17.62*AverageTemp/(243.12+AverageTemp)) ]
Psat1980 EVAL [ 6.1094 * EXP(17.625*Temperature/(243.04+Temperature)) ]
PsatSub0 EVAL [ 6.112 * EXP(22.46*Temperature/(272.62+Temperature)) ]
 
; Actual Vapour Pressure
Avp Eval [ Humidity / 100 * Psat2008 ]
 
; Humidex as in CMX
CDLHumidex Eval [ (Temperature + 5.0 / 9.0 * (Psat2008 - 10.0)) ]
 
; Do the WindChill According to https://sciencing.com/relative-humidity-7611453.html / CMX
; Note: the eqn is only valid for degr Celsius and Kmh.
; See https://sciencing.com/relative-humidity-7611453.html for imperial formula.
; WindPOW Eval [ pow(WindSpeed, 0.16) ]
; CDLWindChill Eval [ 13.12 + 0.6215 * Temperature - 11.37 * WindPOW + 0.3965 * Temperature * WindPOW ]
 
; Apparent Temperature as in CMX (WindSpeed in ms so convert to Kmh, divide by 3.6
AppTemp Eval [ Temperature + 0.33 * Avp - 0.7 * WindSpeed / 3.6 - 4.0 ]
 
; WetbulbTemperature in degr Celsius
WetBulbTemp Eval [ 0.00066 * Pressure * Temperature + 4098 * Psat2008 / (Pow( Dewpoint + 237.7, 2) * Dewpoint) / (0.00066 * Pressure + 4098 * Psat2008 / Pow(Dewpoint + 237.7, 2)) ]
 
 
Chart Overzicht Title Overzicht van de huidige weerstatus ConnectsTo 2 4 15 20
Has WindBarbs Above
PLOT Temperature Colour #058DC7 zindex 90
PLOT DewPoint Colour #50B432 zindex 80
PLOT pressure Colour red zindex 70
Plot Humidity Colour #64E572 zindex 60
Plot SolarRadiationCurrentSolarRad As Area Opacity 0.2 Colour Orange zindex 20
Plot RainFall As Area colour #33B4FF opacity 0.2 zindex 10
EndChart
 
Chart TemperatuurTemperature Title TemperatuurTemperature enand afgeleidenderivatives ConnectsTo 1 13 14
ConnectsTo 1 13 14
Plot InsideTemp As Spline Colour #DDDF00 zIndex 100
PLOT Temperature As SPline Colour #058DC7 zindex 90
EndCHART
 
Chart Wind Title Wind ConnectsTo 5 8
ConnectsTo 5 8
Plot WindGust
Plot WindSpeedWindGust
Plot WindSpeed
EndCHART
 
Chart WindrichtingWindDirection Title WindrichtingWind ConnectsTo 6 7Direction
ConnectsTo 6 7
Plot Bearing As Scatter
Plot AverageBearingBearing As Scatter
Plot AverageBearing As Scatter
EndCHART
 
Chart RegenRain Title RegenRain and RegensnelheidRainspeed ConnectsTo 3 21 22
ConnectsTo 3 21 22
Plot RainFall As Area Colour green Opacity 0.2
Plot RainRate zIndex 100
EndChart
 
Chart Humidity Title Relative Humidity
Chart Vochtigheid Title Relatieve vochtigheid binnen en buiten ConnectsTo 11 16
ConnectsTo 11 16
Plot Humidity
Plot InsideHumidity
EndChart
 
Chart ZonSolar Title (Max)Straling enRadiation and UV ConnectsTo 12 23 24
ConnectsTo 12 23 24
Plot UV zIndex 100
Plot UV zIndex 100
Plot SolarRadiation As Area Opacity 0.4 Colour Orange zIndex 50
Plot TheoreticalSolarMax CurrentSolarRad As Area Opacity 0.4 Colour GoldOrange zIndex 1050 Opacity 0.2
Plot TheoreticalSolarMax As Area Colour Gold zIndex 10 Opacity 0.2
EndChart
 
CHART DagelijkseTempDailyTemp TITLE DagelijkseDaily gem.average temperatuurTemperature metwith columnrangecolumn range
PLOT DAILY AverageTemp colour green As ColumnRange
PLOT DAILY AverageTemp colour black As spline
EndChart
 
CHART DagelijkseBaroDailyPressure TITLE DagelijkseDaily gem.average barometerBarometer metwith columnrangecolumn range
PLOT DAILY MinBarometer colour Crimson As ColumnRange
PLOT DAILY AverageBarometer EVAL [ (MinBarometer + MaxBarometer)/2 ] colour black As spline Axis Pressure
EndChart
 
; DO NOT CHANGE ANYTHING BELOW THIS INDICATOR LINE
CHART DagTemp TITLE Dagelijkse Gemiddelde Temperatuur met Min/Max van afgelopen jaar
; ExtraSensorCharts
PLOT DAILY AverageTemp colour green
Plot DAILY MinTemp colour blue
Plot DAILY MaxTemp colour red
EndChart OUTPUT AllChart.txt
 
Chart DagRegen Title Dagelijkse regenval van afgelopen jaar
Plot DAILY RainFall As Column colour lightblue
EndChart
 
Chart DagZonuren Title Zonuren per dag van afgelopen jaar
Plot ALL SunHours As Column colour gold
EndChart
 
Chart TempEVT Title Temperatuur en EVT - Historische Data ConnectsTo 12 23 24
PLOT ALL AverageTemp As SPline Colour #058DC7 zindex 90 LineWidth 10
PLOT ALL Evapotranspiration As Column Colour #cc0000
EndCHART OUTPUT RarityCharts.txt
 
Chart TempEVTRecent Title Temperatuur en EVT - Recente Data
PLOT Temperature As SPline Colour #058DC7 zindex 90 LineWidth 10
PLOT Evapotranspiration As Area Colour #cc0000
EndCHART
 
Chart CoolingDays Title Overige variabelen
Plot All AverageTemp
Plot ALL CoolingDegreeDays
Plot ALL HeatingDegreeDays
Plot All Evapotranspiration
EndChart
 
CHART DailyTemp TITLE Dagelijkse temp met rangecolumn
PLOT DAILY AverageTemp colour green As ColumnRange
PLOT DAILY AverageTemp colour black As spline
EndChart OUTPUT ColumnRange.txt
 
CHART DailyBarometer TITLE Dagelijkse Barometer met rangecolumn
PLOT DAILY MinBarometer colour Crimson As ColumnRange
PLOT DAILY AverageBarometer EVAL [ (MinBarometer + MaxBarometer)/2 ] colour black As spline Axis Pressure
EndChart
 
CHART DailyTempStats TITLE Temp with statistics offset 5
PLOT ALL AverageTemp colour pink
PLOT ALL sumAverageTemp EVAL [ Sum(AverageTemp-5) ] COLOUR green AXIS DegreeDays
STATS ALL AverageTemp SMA COLOUR crimson
EndChart Output Statistics.txt
 
CHART DailyRainStats TITLE Rain with statistics
PLOT ALL RainFall colour CornflowerBlue as column
PLOT ALL sumRainFall EVAL [ SUM( RainFall) ] COLOUR crimson AXIS Free
STATS ALL RainFall SMA colour green
EndChart
 
; Documentation:
; https://en.wikipedia.org/wiki/Dew_point
; https://iridl.ldeo.columbia.edu/dochelp/QA/Basic/dewpoint.html
;
; Compare the Dewpoint from Cumulus with the caclculated approximation
; Later I will enter the Cumulus Calculation and have the Humidity be produced by the Davis station
; Nice comparison
;
 
Chart Dewpoint Title Dewpoint Calculations in CDL
Plot Humidity
Plot Dewpoint
Plot Approximation1 EVAL [ (243.12 * LN(Psat2008) - 440.1) / (19.43 - LN(Psat2008)) ] Axis Temp
Plot Approximation2 EVAL [ Temperature - ((100 - Humidity)/5) ] Axis Temp
; STATS Dewpoint SMA colour green
EndChart
 
Chart VapourPressure Title August-Roche-Magnus Eqn 1980/2008/SubZero in CDL
Plot Temperature
Plot Psat2008 Eval [ Psat2008 ] Axis Free
Plot Psat1980 Eval [ Psat1980 ] Axis Free
Plot PsatSub0 Eval [ PsatSub0 ] Axis Free
Plot Avp Eval [ Avp ] Axis Free
EndChart
 
Chart TempDerivatives Title Temperature Derivatives full in CDL
Plot Temperature
; Plot CDLWindChill Eval [ CDLWindChill ] Axis Temp
Plot AppTemp Eval [ AppTemp ] Axis Temp
Plot WetBulbTemp Eval [ WetBulbTemp ] Axis Temp
Plot CDLHumidex Eval [ CDLHumidex ] Axis Temp
EndChart
 
Chart pwsFWI Title Raw pwsFWI as a chart
Plot DAILY pwsFWI Eval [ Psat2008ALL * (1 - MinHumidity/100)*HighAvgWindSpeed ] As spline Axis Free Colour Crimson
EndChart Output pwsFWIchart.txt
 
Chart pwsFWInow Title Raw pwsFWI intraday as a chart
Plot RECENT pwsFWI Eval [ Psat2008 * (1 - Humidity/100)*WindSpeed ] As spline Axis Free Colour Red
EndChart
</pre>
 

Navigation menu