## Mathematical operations

**Moderator:** Mattk

### Mathematical operations

Hello everyone, question, is it possible to perform mathematical operations via the meteohub? I better explain myself from the tag [actual_th0_temp_c] I want to subtract [last60m_th0_temp_c] ( [actual_th0_temp_c]-[last60m_th0_temp_c] ), which formula should I use? Thanks so much.

### Re: Mathematical operations

I could be wrong but I don't think there is any way to do what you want The Meteohub has only limited ability to manipulate actual square bracket weather data values. See the Meteohub manual v4.7 pages 71-73.

There may be other ways handle the calculation. What is the result to be used for?

There may be other ways handle the calculation. What is the result to be used for?

### Re: Mathematical operations

Hello, I would need the result to make a comparison of the temperature at the same time yesterday and that of a year ago .....

### Re: Mathematical operations

If you have a website, you could output the two values as a txt file and then use a little PHP program to handle the subtraction. This would be somewhat similar to the way the Revised Chandler Burning Index: viewtopic.php?f=9&t=14614 is handled, except the calculations would be handled outside of the Meteohub in the PHP program..

### Re: Mathematical operations

I had already seen posts about these functions, I wanted to find something simpler without complicating life too much. Anyway, thank you for replying. Although I am of the opinion that a system like meteohub should allow me to do these calculations. Thanks so much.

### Re: Mathematical operations

One more try at your problem. You might take a look at this math formula on page 73 of the manual:

"{math- val1 val2 ... valn}" subtracts enclosed values from position two on from

number at position 1. For example, "{math- 2 5 -1}" returns "-2.00". Computation: (2 -

5) - (-1)

You would have to get your temp yesterday as val1 and the temp a year ago as val2

I'm sorry that I can't help you further. I haven't really worked with manipulating data in this square bracket format [like this} within the Meteohub other that outputting values to a HTML page.

"{math- val1 val2 ... valn}" subtracts enclosed values from position two on from

number at position 1. For example, "{math- 2 5 -1}" returns "-2.00". Computation: (2 -

5) - (-1)

You would have to get your temp yesterday as val1 and the temp a year ago as val2

I'm sorry that I can't help you further. I haven't really worked with manipulating data in this square bracket format [like this} within the Meteohub other that outputting values to a HTML page.

### Re: Mathematical operations

Dont worry d_I , thank you so much for trie to help me......

### Re: Mathematical operations

I believe what you're trying to accomplish is possible via the "virtual sensors" function. I'm not sure how/where you're going to source the non-sensor or legacy data, but math functions are possible via "awk". Look at the manual for virtual sensors and awk.

I'm currently using an i2c magnetometer (compass) to write a compass heading to a file with python, then using a virtual sensor to replace the anemometer direction data with the compass heading via awk. My weather station is on a boat that is moored to a single point and it rotates around that point. The boat functions as the wind-direction because the wind direction of my sensor array always says the wind is from the North as the boat rotates.

If you're interested I can post some of the virtual sensor code that I use to do mathematical operation so you can see what I've done.

Take a look around page #32 of https://www.meteohub.de/files/meteohub-v4.7en.pdf

I'm currently using an i2c magnetometer (compass) to write a compass heading to a file with python, then using a virtual sensor to replace the anemometer direction data with the compass heading via awk. My weather station is on a boat that is moored to a single point and it rotates around that point. The boat functions as the wind-direction because the wind direction of my sensor array always says the wind is from the North as the boat rotates.

If you're interested I can post some of the virtual sensor code that I use to do mathematical operation so you can see what I've done.

Take a look around page #32 of https://www.meteohub.de/files/meteohub-v4.7en.pdf