In this document
We will explain how to work with the Calculator and calculate new values for your dataset.
The Calculator enables you to amend the dataset’s data, add new columns, or calculate missing values from the available data in the dataset. It is a very powerful tool that can help you tailor the data to your requirements.
You can open the Calculator from the main menu via Tools/Calculator, right-clicking the dataset and selecting Calculator, or by using the quick access icon located below the main menu.
Key points to remember
The Calculator will open for the selected dataset only.
The Calculator rewrites your data in the dataset. We recommend backing up the dataset and making changes in the duplicated one in case you make any irreversible mistakes.
Calculations may take a moment depending on the size of your dataset.
Double-clicking the parameter in the Columns tab or a function in the Functions tab will add it to the selected expression window.
Only valid expressions can be used in calculations.
Creating new columns for calculated data
If you do not want to overwrite values in existing columns in the dataset, create new columns first. You will use these columns for the new, calculated values, without overwriting any existing data. You can skip this step if you are planning to overwrite values in existing columns.
Click the “New” button at the bottom of the Columns tab.
Add the name of the new parameter, select the parameter type the values will represent, and choose the desired units. You can also add a description to the column if required.
If you want a flag column to be created along with the new parameter column, check the “Create flag column” option. Click the “Create” button to create the new column.
Selecting the column for calculated values
You can select the column where the new calculated values will be added at the top of the Calculation expression tab. The dropdown offers all columns available in the Columns list. Remember that the values in the selected column will be overwritten with the calculated values.
Selecting the data to use for calculation
Unless you state which records will be overwritten/added to the calculation, the application will apply the calculation to all values in the selected column. To choose only specific values to be calculated and overwritten, use the Selector expression. Selector expression examples are provided under the image.
Open the Selector expression tab using the arrow to the top-right.
Use the expression operators provided under the tab and in the Functions section to help you write your expression quickly. Double-click the functions and parameters to add them to the selected expression section.
Apply the expression using the “Apply selection” button. The expression’s status/validation is displayed next to the button.
Selector expressions examples
Type | Description | Expression |
Datetime selection | From a specific date (year) | col["datetime"] > "2018" |
From a specific date (year) | col["datetime"] > "2017-10" | |
From a specific date (year) | col["datetime"] > "2017-10-30" | |
From a specific date (year) | col["datetime"] > "2017-09-30 10:35:00" | |
Exact date (year)* | col["datetime"] == "2017-09-30" | |
Excludes date* | col["datetime"] != "2017-09-30" | |
Combination using logical operators | (col["datetime"] > "2017-09-30 10:35:00") And (col["datetime"] < "2017-09-30 12:15:00") | |
Combination using logical operators | (col["datetime"] > "2017-09-30") And (col["datetime"] < "2017-10-01") | |
Combination using logical operators | (col["datetime"] > "10:00") And (col["datetime"] < "15:00") | |
Column selection | Combination using logical operators | (( col["GHI"] + col["DNI"] ) > 1200) And (col["TEMP"] < 30.2) |
Combination using logical operators | (( col["GHI"] + col["DNI"] ) > 1200) And (Not( col["TEMP"] > 30.2)) | |
Mixed selection | Combination using logical operators | (Not((col["datetime"] > "09:00") And (col["datetime"] < "15:00"))) Or (col["GHI"] > 800 ) And (col["DNI"] < 500) |
Using table view to manage selection
The table view shows the values selected by the Selector expression. You can also manually add or remove values from the selection here. The table view may take some time to open depending on the size of the dataset.
Click the arrow at the bottom-right to open the table view. Values selected by the expression are highlighted in yellow.
If you want to invert the selection, use the “Switch selection” button.
To add or remove values from the selection, select the required values, right-click the mouse, and select the desired action. Additionally, you can move the selected values to the top for better organization.
If you want to display selected values only, check the “Selected record only” option.
Note: Added or removed values using this method are applied to the selection automatically. You do not need to use the “Apply selection” button.
Table view also enables you to delete the selected rows using the “Delete records” button.
Calculating the new values
If you are ready to calculate the new values, provide the calculation expression in the respective tab and click the “Calculate” button. The values will be calculated and added to the dataset according to the expression and selection provided. You can find useful calculation expression examples under the image.
Tip: Text to the left of the “Calculated” button offers quick insight into number of currently selected values or calculation status.
Calculation expressions examples
Type | Description | Expression |
Calculating missing solar irradiance components | GHI - Global horizontal irradiance | col["DNI"] * sin(radians(sun_elevation)) + col["DIF"] |
DNI - Direct normal irradiance | (col["GHI"] - col["DIF"]) / sin(radians(sun_elevation)) | |
DIF - Diffuse horizontal irradiance | col["GHI"] - col["DNI"] * sin(radians(sun_elevation)) | |
Kt - Clearness index | col["GHI"] / ETR_horizontal | |
Ktb | col["DNI"] / ETR_normal | |
D2G - Diffuse to global ratio | col["DIF"] / col["GHI"] | |
Unit conversions | Temperature Celsius to Fahrenheit | col["TEMP"] * 1.8 + 32 |
Temperature Fahrenheit to Celsius | (col["TEMP"] - 32)*(5/9) | |
Irradiation kWh/m2 to kJ/m2 | col["DNI"] * 3600 | |
Irradiation kJ/m2 to kWh/m2 | col["DNI"] / 3600 |
Saving the changes
Once the calculations are finished, the new data, created columns, and calculated values are visible in the Calculator tool only. If you want to write the changes to the dataset, you must save it using the “Save” button at the bottom-right.