Re: [weewx-user] When did the blast wave of the eruption "hit" your station? - extract your data

2022-01-23 Thread morr...@gmail.com
Interesting, no sign of a pulse from the second trip around.

On Sunday, January 23, 2022 at 6:29:38 p.m. UTC-4 storm...@gmail.com wrote:

> Data from both Davis and Acurite PWS
>
> [image: hunga_tonga_davis.png]
>
> [image: hunga_tonga_acurite.png]
>
> On Sunday, January 23, 2022 at 4:26:46 PM UTC-5 bgra...@umw.edu wrote:
>
>> Bingo! Many thanks!  Bob
>>
>> bg@n4mrv:~/weewx_tonga_browse-main$ sudo python3 ./tonga_barometer.py
>> distance to eruption 12056.6 km
>> arrival at 1642257762 (2022-01-15 09:42:41)
>> opposite pulse arrival at 1642307533 (2022-01-15 23:32:13)
>> second time around pulse arrival at 1642382887 (2022-01-16 20:28:06)
>> select datetime, barometer from archive where datetime > 1642240800 and 
>> datetime
>>  < 1642395600 and barometer is not null order by dateTime;
>> query returned 171 data points
>> Fitting between 1642240800.0 and 1642395600.0 with 10 knots
>>
>> [image: Figure_1.png]
>>
>> On Sunday, January 23, 2022 at 11:56:22 AM UTC-5 bgra...@umw.edu wrote:
>>
>>> Hi morrowwm,
>>> I have tried your latest github post and am getting the following error:
>>> ```
>>> root@n4mrv:/home/bg/weewx_tonga_browse-main# ./tonga_barometer.py
>>>
>>> distance to eruption 12056.6 km
>>> arrival at 1642257762 (2022-01-15 09:42:41)
>>> opposite pulse arrival at 1642307533 (2022-01-15 23:32:13)
>>> second time around pulse arrival at 1642382887 (2022-01-16 20:28:06)
>>> select datetime, barometer from archive where datetime > 1642240800 and 
>>> datetime < 1642395600 and barometer is not null order by dateTime;
>>> query returned 171 data points
>>>
>>> Traceback (most recent call last):
>>>   File "./tonga_barometer.py", line 96, in 
>>> knots = np.linspace(np.min(tdata), np.max(tdata), 
>>> (stop_time-start_time)/(3600*smoothing_hours), endpoint=True)  # spline 
>>> knot every N hours
>>>   File "<__array_function__ internals>", line 180, in linspace
>>>   File 
>>> "/usr/local/lib/python3.8/dist-packages/numpy/core/function_base.py", line 
>>> 120, in linspace
>>> num = operator.index(num)
>>> TypeError: 'float' object cannot be interpreted as an integer
>>> ```
>>> The earlier version worked correctly and I don't think I have changed 
>>> anything. I am using the same copy of weewx.sdb and only changed my 
>>> lat/lon. 
>>> Much appreciated for your work on this software.
>>> Cheers,
>>> Bob
>>> On Saturday, January 22, 2022 at 4:14:51 PM UTC-5 morr...@gmail.com 
>>> wrote:
>>>
 Also, I found a bug in calculating the smooth (spline fit) curve which 
 is removed to highlight the eruption events. Added display of the points 
 used to calculate the fitted curve.

 On Saturday, January 22, 2022 at 4:32:47 p.m. UTC-4 morr...@gmail.com 
 wrote:

> Forgot that, thanks for the reminder. Added now.
>
> On Saturday, January 22, 2022 at 4:22:51 p.m. UTC-4 storm...@gmail.com 
> wrote:
>
>> Nice work (Morrowwn  thanks!).  If you have any nulls in the data 
>> during the selected timeframe, change the query to read:  (Cameron D 
>> thanks!)
>>
>> *query = "select datetime, barometer from archive where datetime > 
>> %.0f and datetime < %.0f and barometer is not null order by dateTime;" % 
>> (start_time, stop_time)*
>>
>>
>>
>>
>> [image: hunga_tonga.png]
>>
>> If you want the bars closer to the rise and falls of the events, need 
>> to adjust the speed of sound slightly.
>> On Saturday, January 22, 2022 at 2:37:09 PM UTC-5 pmcg...@gmail.com 
>> wrote:
>>
>>> WOW!  This is some interesting data, here is my location in Northern 
>>> Utah.  Looks like the reverse may be a little off in calculation but 
>>> this 
>>> made it easy to find instead of hunting through the data.
>>>
>>> Great Work!
>>> [image: hunga_tonga.png]
>>> On Saturday, January 22, 2022 at 12:16:45 PM UTC-7 morr...@gmail.com 
>>> wrote:
>>>
 Did an update to my script at: 
 https://github.com/morrowwm/weewx_tonga_browse

 Mostly incorporating additions from Cameron (thanks!)

 All parameters you likely want to set are near the top of the 
 script.

1. support for mysql (untested, I don't have a mysql based 
weewx installation)
2. calculation and display of all three initial arrival, 
arrival from opposite direction, and second arrival after one trip 
 around 
the globe
3. highlighting of the three events with grey bars
4. cubic spline curve fit of raw data and use of that fit to 
remove the base pressure variations. The new smoothing_hours 
 parameter can 
be used to control how close the fit is. 
5. changed the display of data to highlight the extracted 
events and subdue the original data, other cosmetic changes

 I had a data outage about 26 hours 

Re: [weewx-user] When did the blast wave of the eruption "hit" your station? - extract your data

2022-01-23 Thread morr...@gmail.com
OK, I've put the fix up on github. Thanks for finding this bug.

On Sunday, January 23, 2022 at 5:26:46 p.m. UTC-4 bgra...@umw.edu wrote:

> Bingo! Many thanks!  Bob
>
> bg@n4mrv:~/weewx_tonga_browse-main$ sudo python3 ./tonga_barometer.py
> distance to eruption 12056.6 km
> arrival at 1642257762 (2022-01-15 09:42:41)
> opposite pulse arrival at 1642307533 (2022-01-15 23:32:13)
> second time around pulse arrival at 1642382887 (2022-01-16 20:28:06)
> select datetime, barometer from archive where datetime > 1642240800 and 
> datetime
>  < 1642395600 and barometer is not null order by dateTime;
> query returned 171 data points
> Fitting between 1642240800.0 and 1642395600.0 with 10 knots
>
> [image: Figure_1.png]
>
> On Sunday, January 23, 2022 at 11:56:22 AM UTC-5 bgra...@umw.edu wrote:
>
>> Hi morrowwm,
>> I have tried your latest github post and am getting the following error:
>> ```
>> root@n4mrv:/home/bg/weewx_tonga_browse-main# ./tonga_barometer.py
>>
>> distance to eruption 12056.6 km
>> arrival at 1642257762 (2022-01-15 09:42:41)
>> opposite pulse arrival at 1642307533 (2022-01-15 23:32:13)
>> second time around pulse arrival at 1642382887 (2022-01-16 20:28:06)
>> select datetime, barometer from archive where datetime > 1642240800 and 
>> datetime < 1642395600 and barometer is not null order by dateTime;
>> query returned 171 data points
>>
>> Traceback (most recent call last):
>>   File "./tonga_barometer.py", line 96, in 
>> knots = np.linspace(np.min(tdata), np.max(tdata), 
>> (stop_time-start_time)/(3600*smoothing_hours), endpoint=True)  # spline 
>> knot every N hours
>>   File "<__array_function__ internals>", line 180, in linspace
>>   File 
>> "/usr/local/lib/python3.8/dist-packages/numpy/core/function_base.py", line 
>> 120, in linspace
>> num = operator.index(num)
>> TypeError: 'float' object cannot be interpreted as an integer
>> ```
>> The earlier version worked correctly and I don't think I have changed 
>> anything. I am using the same copy of weewx.sdb and only changed my 
>> lat/lon. 
>> Much appreciated for your work on this software.
>> Cheers,
>> Bob
>> On Saturday, January 22, 2022 at 4:14:51 PM UTC-5 morr...@gmail.com 
>> wrote:
>>
>>> Also, I found a bug in calculating the smooth (spline fit) curve which 
>>> is removed to highlight the eruption events. Added display of the points 
>>> used to calculate the fitted curve.
>>>
>>> On Saturday, January 22, 2022 at 4:32:47 p.m. UTC-4 morr...@gmail.com 
>>> wrote:
>>>
 Forgot that, thanks for the reminder. Added now.

 On Saturday, January 22, 2022 at 4:22:51 p.m. UTC-4 storm...@gmail.com 
 wrote:

> Nice work (Morrowwn  thanks!).  If you have any nulls in the data 
> during the selected timeframe, change the query to read:  (Cameron D 
> thanks!)
>
> *query = "select datetime, barometer from archive where datetime > 
> %.0f and datetime < %.0f and barometer is not null order by dateTime;" % 
> (start_time, stop_time)*
>
>
>
>
> [image: hunga_tonga.png]
>
> If you want the bars closer to the rise and falls of the events, need 
> to adjust the speed of sound slightly.
> On Saturday, January 22, 2022 at 2:37:09 PM UTC-5 pmcg...@gmail.com 
> wrote:
>
>> WOW!  This is some interesting data, here is my location in Northern 
>> Utah.  Looks like the reverse may be a little off in calculation but 
>> this 
>> made it easy to find instead of hunting through the data.
>>
>> Great Work!
>> [image: hunga_tonga.png]
>> On Saturday, January 22, 2022 at 12:16:45 PM UTC-7 morr...@gmail.com 
>> wrote:
>>
>>> Did an update to my script at: 
>>> https://github.com/morrowwm/weewx_tonga_browse
>>>
>>> Mostly incorporating additions from Cameron (thanks!)
>>>
>>> All parameters you likely want to set are near the top of the script.
>>>
>>>1. support for mysql (untested, I don't have a mysql based weewx 
>>>installation)
>>>2. calculation and display of all three initial arrival, arrival 
>>>from opposite direction, and second arrival after one trip around 
>>> the globe
>>>3. highlighting of the three events with grey bars
>>>4. cubic spline curve fit of raw data and use of that fit to 
>>>remove the base pressure variations. The new smoothing_hours 
>>> parameter can 
>>>be used to control how close the fit is. 
>>>5. changed the display of data to highlight the extracted events 
>>>and subdue the original data, other cosmetic changes
>>>
>>> I had a data outage about 26 hours after the event, we're quite a 
>>> distance from Tonga, plus a major storm was clearing out in our area. 
>>> So 
>>> not obviously anything unusual happened.
>>>
>>> Some scientist might be interested in the arrival times of all this 
>>> data, though.
>>> [image: hunga_tonga.png]
>>>

Re: [weewx-user] When did the blast wave of the eruption "hit" your station? - extract your data

2022-01-23 Thread bgra...@umw.edu
Bingo! Many thanks!  Bob

bg@n4mrv:~/weewx_tonga_browse-main$ sudo python3 ./tonga_barometer.py
distance to eruption 12056.6 km
arrival at 1642257762 (2022-01-15 09:42:41)
opposite pulse arrival at 1642307533 (2022-01-15 23:32:13)
second time around pulse arrival at 1642382887 (2022-01-16 20:28:06)
select datetime, barometer from archive where datetime > 1642240800 and 
datetime
 < 1642395600 and barometer is not null order by dateTime;
query returned 171 data points
Fitting between 1642240800.0 and 1642395600.0 with 10 knots

[image: Figure_1.png]

On Sunday, January 23, 2022 at 11:56:22 AM UTC-5 bgra...@umw.edu wrote:

> Hi morrowwm,
> I have tried your latest github post and am getting the following error:
> ```
> root@n4mrv:/home/bg/weewx_tonga_browse-main# ./tonga_barometer.py
>
> distance to eruption 12056.6 km
> arrival at 1642257762 (2022-01-15 09:42:41)
> opposite pulse arrival at 1642307533 (2022-01-15 23:32:13)
> second time around pulse arrival at 1642382887 (2022-01-16 20:28:06)
> select datetime, barometer from archive where datetime > 1642240800 and 
> datetime < 1642395600 and barometer is not null order by dateTime;
> query returned 171 data points
>
> Traceback (most recent call last):
>   File "./tonga_barometer.py", line 96, in 
> knots = np.linspace(np.min(tdata), np.max(tdata), 
> (stop_time-start_time)/(3600*smoothing_hours), endpoint=True)  # spline 
> knot every N hours
>   File "<__array_function__ internals>", line 180, in linspace
>   File 
> "/usr/local/lib/python3.8/dist-packages/numpy/core/function_base.py", line 
> 120, in linspace
> num = operator.index(num)
> TypeError: 'float' object cannot be interpreted as an integer
> ```
> The earlier version worked correctly and I don't think I have changed 
> anything. I am using the same copy of weewx.sdb and only changed my 
> lat/lon. 
> Much appreciated for your work on this software.
> Cheers,
> Bob
> On Saturday, January 22, 2022 at 4:14:51 PM UTC-5 morr...@gmail.com wrote:
>
>> Also, I found a bug in calculating the smooth (spline fit) curve which is 
>> removed to highlight the eruption events. Added display of the points used 
>> to calculate the fitted curve.
>>
>> On Saturday, January 22, 2022 at 4:32:47 p.m. UTC-4 morr...@gmail.com 
>> wrote:
>>
>>> Forgot that, thanks for the reminder. Added now.
>>>
>>> On Saturday, January 22, 2022 at 4:22:51 p.m. UTC-4 storm...@gmail.com 
>>> wrote:
>>>
 Nice work (Morrowwn  thanks!).  If you have any nulls in the data 
 during the selected timeframe, change the query to read:  (Cameron D 
 thanks!)

 *query = "select datetime, barometer from archive where datetime > %.0f 
 and datetime < %.0f and barometer is not null order by dateTime;" % 
 (start_time, stop_time)*




 [image: hunga_tonga.png]

 If you want the bars closer to the rise and falls of the events, need 
 to adjust the speed of sound slightly.
 On Saturday, January 22, 2022 at 2:37:09 PM UTC-5 pmcg...@gmail.com 
 wrote:

> WOW!  This is some interesting data, here is my location in Northern 
> Utah.  Looks like the reverse may be a little off in calculation but this 
> made it easy to find instead of hunting through the data.
>
> Great Work!
> [image: hunga_tonga.png]
> On Saturday, January 22, 2022 at 12:16:45 PM UTC-7 morr...@gmail.com 
> wrote:
>
>> Did an update to my script at: 
>> https://github.com/morrowwm/weewx_tonga_browse
>>
>> Mostly incorporating additions from Cameron (thanks!)
>>
>> All parameters you likely want to set are near the top of the script.
>>
>>1. support for mysql (untested, I don't have a mysql based weewx 
>>installation)
>>2. calculation and display of all three initial arrival, arrival 
>>from opposite direction, and second arrival after one trip around the 
>> globe
>>3. highlighting of the three events with grey bars
>>4. cubic spline curve fit of raw data and use of that fit to 
>>remove the base pressure variations. The new smoothing_hours 
>> parameter can 
>>be used to control how close the fit is. 
>>5. changed the display of data to highlight the extracted events 
>>and subdue the original data, other cosmetic changes
>>
>> I had a data outage about 26 hours after the event, we're quite a 
>> distance from Tonga, plus a major storm was clearing out in our area. So 
>> not obviously anything unusual happened.
>>
>> Some scientist might be interested in the arrival times of all this 
>> data, though.
>> [image: hunga_tonga.png]
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 

Re: [weewx-user] When did the blast wave of the eruption "hit" your station? - extract your data

2022-01-23 Thread Tom Hogland
Mine, from 9400km (Alaska). Not too bad of a match, although reducing speed 
to .31 brings it closer. Regardless, using .32 lets you pick out the 
pressure waves. We actually heard the initial eruption up here was well...

On Sunday, January 23, 2022 at 7:56:22 AM UTC-9 bgra...@umw.edu wrote:

> Hi morrowwm,
> I have tried your latest github post and am getting the following error:
> ```
> root@n4mrv:/home/bg/weewx_tonga_browse-main# ./tonga_barometer.py
>
> distance to eruption 12056.6 km
> arrival at 1642257762 (2022-01-15 09:42:41)
> opposite pulse arrival at 1642307533 (2022-01-15 23:32:13)
> second time around pulse arrival at 1642382887 (2022-01-16 20:28:06)
> select datetime, barometer from archive where datetime > 1642240800 and 
> datetime < 1642395600 and barometer is not null order by dateTime;
> query returned 171 data points
>
> Traceback (most recent call last):
>   File "./tonga_barometer.py", line 96, in 
> knots = np.linspace(np.min(tdata), np.max(tdata), 
> (stop_time-start_time)/(3600*smoothing_hours), endpoint=True)  # spline 
> knot every N hours
>   File "<__array_function__ internals>", line 180, in linspace
>   File 
> "/usr/local/lib/python3.8/dist-packages/numpy/core/function_base.py", line 
> 120, in linspace
> num = operator.index(num)
> TypeError: 'float' object cannot be interpreted as an integer
> ```
> The earlier version worked correctly and I don't think I have changed 
> anything. I am using the same copy of weewx.sdb and only changed my 
> lat/lon. 
> Much appreciated for your work on this software.
> Cheers,
> Bob
> On Saturday, January 22, 2022 at 4:14:51 PM UTC-5 morr...@gmail.com wrote:
>
>> Also, I found a bug in calculating the smooth (spline fit) curve which is 
>> removed to highlight the eruption events. Added display of the points used 
>> to calculate the fitted curve.
>>
>> On Saturday, January 22, 2022 at 4:32:47 p.m. UTC-4 morr...@gmail.com 
>> wrote:
>>
>>> Forgot that, thanks for the reminder. Added now.
>>>
>>> On Saturday, January 22, 2022 at 4:22:51 p.m. UTC-4 storm...@gmail.com 
>>> wrote:
>>>
 Nice work (Morrowwn  thanks!).  If you have any nulls in the data 
 during the selected timeframe, change the query to read:  (Cameron D 
 thanks!)

 *query = "select datetime, barometer from archive where datetime > %.0f 
 and datetime < %.0f and barometer is not null order by dateTime;" % 
 (start_time, stop_time)*




 [image: hunga_tonga.png]

 If you want the bars closer to the rise and falls of the events, need 
 to adjust the speed of sound slightly.
 On Saturday, January 22, 2022 at 2:37:09 PM UTC-5 pmcg...@gmail.com 
 wrote:

> WOW!  This is some interesting data, here is my location in Northern 
> Utah.  Looks like the reverse may be a little off in calculation but this 
> made it easy to find instead of hunting through the data.
>
> Great Work!
> [image: hunga_tonga.png]
> On Saturday, January 22, 2022 at 12:16:45 PM UTC-7 morr...@gmail.com 
> wrote:
>
>> Did an update to my script at: 
>> https://github.com/morrowwm/weewx_tonga_browse
>>
>> Mostly incorporating additions from Cameron (thanks!)
>>
>> All parameters you likely want to set are near the top of the script.
>>
>>1. support for mysql (untested, I don't have a mysql based weewx 
>>installation)
>>2. calculation and display of all three initial arrival, arrival 
>>from opposite direction, and second arrival after one trip around the 
>> globe
>>3. highlighting of the three events with grey bars
>>4. cubic spline curve fit of raw data and use of that fit to 
>>remove the base pressure variations. The new smoothing_hours 
>> parameter can 
>>be used to control how close the fit is. 
>>5. changed the display of data to highlight the extracted events 
>>and subdue the original data, other cosmetic changes
>>
>> I had a data outage about 26 hours after the event, we're quite a 
>> distance from Tonga, plus a major storm was clearing out in our area. So 
>> not obviously anything unusual happened.
>>
>> Some scientist might be interested in the arrival times of all this 
>> data, though.
>> [image: hunga_tonga.png]
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/c20c583f-1d4d-4b01-858a-2a30d7fbe9e7n%40googlegroups.com.


Re: [weewx-user] When did the blast wave of the eruption "hit" your station? - extract your data

2022-01-23 Thread bgra...@umw.edu
Hi morrowwm,
I have tried your latest github post and am getting the following error:
```
root@n4mrv:/home/bg/weewx_tonga_browse-main# ./tonga_barometer.py
distance to eruption 12056.6 km
arrival at 1642257762 (2022-01-15 09:42:41)
opposite pulse arrival at 1642307533 (2022-01-15 23:32:13)
second time around pulse arrival at 1642382887 (2022-01-16 20:28:06)
select datetime, barometer from archive where datetime > 1642240800 and 
datetime < 1642395600 and barometer is not null order by dateTime;
query returned 171 data points
Traceback (most recent call last):
  File "./tonga_barometer.py", line 96, in 
knots = np.linspace(np.min(tdata), np.max(tdata), 
(stop_time-start_time)/(3600*smoothing_hours), endpoint=True)  # spline 
knot every N hours
  File "<__array_function__ internals>", line 180, in linspace
  File 
"/usr/local/lib/python3.8/dist-packages/numpy/core/function_base.py", line 
120, in linspace
num = operator.index(num)
TypeError: 'float' object cannot be interpreted as an integer
```
The earlier version worked correctly and I don't think I have changed 
anything. I am using the same copy of weewx.sdb and only changed my 
lat/lon. 
Much appreciated for your work on this software.
Cheers,
Bob
On Saturday, January 22, 2022 at 4:14:51 PM UTC-5 morr...@gmail.com wrote:

> Also, I found a bug in calculating the smooth (spline fit) curve which is 
> removed to highlight the eruption events. Added display of the points used 
> to calculate the fitted curve.
>
> On Saturday, January 22, 2022 at 4:32:47 p.m. UTC-4 morr...@gmail.com 
> wrote:
>
>> Forgot that, thanks for the reminder. Added now.
>>
>> On Saturday, January 22, 2022 at 4:22:51 p.m. UTC-4 storm...@gmail.com 
>> wrote:
>>
>>> Nice work (Morrowwn  thanks!).  If you have any nulls in the data during 
>>> the selected timeframe, change the query to read:  (Cameron D thanks!)
>>>
>>> *query = "select datetime, barometer from archive where datetime > %.0f 
>>> and datetime < %.0f and barometer is not null order by dateTime;" % 
>>> (start_time, stop_time)*
>>>
>>>
>>>
>>>
>>> [image: hunga_tonga.png]
>>>
>>> If you want the bars closer to the rise and falls of the events, need to 
>>> adjust the speed of sound slightly.
>>> On Saturday, January 22, 2022 at 2:37:09 PM UTC-5 pmcg...@gmail.com 
>>> wrote:
>>>
 WOW!  This is some interesting data, here is my location in Northern 
 Utah.  Looks like the reverse may be a little off in calculation but this 
 made it easy to find instead of hunting through the data.

 Great Work!
 [image: hunga_tonga.png]
 On Saturday, January 22, 2022 at 12:16:45 PM UTC-7 morr...@gmail.com 
 wrote:

> Did an update to my script at: 
> https://github.com/morrowwm/weewx_tonga_browse
>
> Mostly incorporating additions from Cameron (thanks!)
>
> All parameters you likely want to set are near the top of the script.
>
>1. support for mysql (untested, I don't have a mysql based weewx 
>installation)
>2. calculation and display of all three initial arrival, arrival 
>from opposite direction, and second arrival after one trip around the 
> globe
>3. highlighting of the three events with grey bars
>4. cubic spline curve fit of raw data and use of that fit to 
>remove the base pressure variations. The new smoothing_hours parameter 
> can 
>be used to control how close the fit is. 
>5. changed the display of data to highlight the extracted events 
>and subdue the original data, other cosmetic changes
>
> I had a data outage about 26 hours after the event, we're quite a 
> distance from Tonga, plus a major storm was clearing out in our area. So 
> not obviously anything unusual happened.
>
> Some scientist might be interested in the arrival times of all this 
> data, though.
> [image: hunga_tonga.png]
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/ca9a23ae-8129-4f91-8e43-4030ad384c14n%40googlegroups.com.


Re: [weewx-user] When did the blast wave of the eruption "hit" your station? - extract your data

2022-01-22 Thread 'Cameron D' via weewx-user
Thanks morrowwm - much better to work from one source.

If anybody is needing to use the mysql version you should be warned that 
there is a ridiculously large number of mysql connector packages, and the 
one I used under Debian 10 is not packaged in Debian 11.
I tried one of the Debian 11 ones and the error handling codes are reported 
differently, so the easiest way out would be to just delete those lines and 
just print the print(err).
Drop me a line if you need help on that.

Cameron.

On Sunday, 23 January 2022 at 5:16:45 am UTC+10 morr...@gmail.com wrote:

> Did an update to my script at: 
> https://github.com/morrowwm/weewx_tonga_browse
>
> Mostly incorporating additions from Cameron (thanks!)
>
> All parameters you likely want to set are near the top of the script.
>
>1. support for mysql (untested, I don't have a mysql based weewx 
>installation)
>2. calculation and display of all three initial arrival, arrival from 
>opposite direction, and second arrival after one trip around the globe
>3. highlighting of the three events with grey bars
>4. cubic spline curve fit of raw data and use of that fit to remove 
>the base pressure variations. The new smoothing_hours parameter can be 
> used 
>to control how close the fit is. 
>5. changed the display of data to highlight the extracted events and 
>subdue the original data, other cosmetic changes
>
> I had a data outage about 26 hours after the event, we're quite a distance 
> from Tonga, plus a major storm was clearing out in our area. So not 
> obviously anything unusual happened.
>
> Some scientist might be interested in the arrival times of all this data, 
> though.
> [image: hunga_tonga.png]
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/db6b198e-5fb4-4cea-8ae5-b7a1a0925a4an%40googlegroups.com.


Re: [weewx-user] When did the blast wave of the eruption "hit" your station? - extract your data

2022-01-22 Thread morr...@gmail.com
Also, I found a bug in calculating the smooth (spline fit) curve which is 
removed to highlight the eruption events. Added display of the points used 
to calculate the fitted curve.

On Saturday, January 22, 2022 at 4:32:47 p.m. UTC-4 morr...@gmail.com wrote:

> Forgot that, thanks for the reminder. Added now.
>
> On Saturday, January 22, 2022 at 4:22:51 p.m. UTC-4 storm...@gmail.com 
> wrote:
>
>> Nice work (Morrowwn  thanks!).  If you have any nulls in the data during 
>> the selected timeframe, change the query to read:  (Cameron D thanks!)
>>
>> *query = "select datetime, barometer from archive where datetime > %.0f 
>> and datetime < %.0f and barometer is not null order by dateTime;" % 
>> (start_time, stop_time)*
>>
>>
>>
>>
>> [image: hunga_tonga.png]
>>
>> If you want the bars closer to the rise and falls of the events, need to 
>> adjust the speed of sound slightly.
>> On Saturday, January 22, 2022 at 2:37:09 PM UTC-5 pmcg...@gmail.com 
>> wrote:
>>
>>> WOW!  This is some interesting data, here is my location in Northern 
>>> Utah.  Looks like the reverse may be a little off in calculation but this 
>>> made it easy to find instead of hunting through the data.
>>>
>>> Great Work!
>>> [image: hunga_tonga.png]
>>> On Saturday, January 22, 2022 at 12:16:45 PM UTC-7 morr...@gmail.com 
>>> wrote:
>>>
 Did an update to my script at: 
 https://github.com/morrowwm/weewx_tonga_browse

 Mostly incorporating additions from Cameron (thanks!)

 All parameters you likely want to set are near the top of the script.

1. support for mysql (untested, I don't have a mysql based weewx 
installation)
2. calculation and display of all three initial arrival, arrival 
from opposite direction, and second arrival after one trip around the 
 globe
3. highlighting of the three events with grey bars
4. cubic spline curve fit of raw data and use of that fit to remove 
the base pressure variations. The new smoothing_hours parameter can be 
 used 
to control how close the fit is. 
5. changed the display of data to highlight the extracted events 
and subdue the original data, other cosmetic changes

 I had a data outage about 26 hours after the event, we're quite a 
 distance from Tonga, plus a major storm was clearing out in our area. So 
 not obviously anything unusual happened.

 Some scientist might be interested in the arrival times of all this 
 data, though.
 [image: hunga_tonga.png]



-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/986683ea-1046-4cb4-9aa4-2a41797c7303n%40googlegroups.com.


Re: [weewx-user] When did the blast wave of the eruption "hit" your station? - extract your data

2022-01-22 Thread morr...@gmail.com
Forgot that, thanks for the reminder. Added now.

On Saturday, January 22, 2022 at 4:22:51 p.m. UTC-4 storm...@gmail.com 
wrote:

> Nice work (Morrowwn  thanks!).  If you have any nulls in the data during 
> the selected timeframe, change the query to read:  (Cameron D thanks!)
>
> *query = "select datetime, barometer from archive where datetime > %.0f 
> and datetime < %.0f and barometer is not null order by dateTime;" % 
> (start_time, stop_time)*
>
>
>
>
> [image: hunga_tonga.png]
>
> If you want the bars closer to the rise and falls of the events, need to 
> adjust the speed of sound slightly.
> On Saturday, January 22, 2022 at 2:37:09 PM UTC-5 pmcg...@gmail.com wrote:
>
>> WOW!  This is some interesting data, here is my location in Northern 
>> Utah.  Looks like the reverse may be a little off in calculation but this 
>> made it easy to find instead of hunting through the data.
>>
>> Great Work!
>> [image: hunga_tonga.png]
>> On Saturday, January 22, 2022 at 12:16:45 PM UTC-7 morr...@gmail.com 
>> wrote:
>>
>>> Did an update to my script at: 
>>> https://github.com/morrowwm/weewx_tonga_browse
>>>
>>> Mostly incorporating additions from Cameron (thanks!)
>>>
>>> All parameters you likely want to set are near the top of the script.
>>>
>>>1. support for mysql (untested, I don't have a mysql based weewx 
>>>installation)
>>>2. calculation and display of all three initial arrival, arrival 
>>>from opposite direction, and second arrival after one trip around the 
>>> globe
>>>3. highlighting of the three events with grey bars
>>>4. cubic spline curve fit of raw data and use of that fit to remove 
>>>the base pressure variations. The new smoothing_hours parameter can be 
>>> used 
>>>to control how close the fit is. 
>>>5. changed the display of data to highlight the extracted events and 
>>>subdue the original data, other cosmetic changes
>>>
>>> I had a data outage about 26 hours after the event, we're quite a 
>>> distance from Tonga, plus a major storm was clearing out in our area. So 
>>> not obviously anything unusual happened.
>>>
>>> Some scientist might be interested in the arrival times of all this 
>>> data, though.
>>> [image: hunga_tonga.png]
>>>
>>>

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/fb0fd561-2540-43bc-a1d9-1edf12ec74e9n%40googlegroups.com.


Re: [weewx-user] When did the blast wave of the eruption "hit" your station? - extract your data

2022-01-22 Thread storm...@gmail.com
Nice work (Morrowwn  thanks!).  If you have any nulls in the data during 
the selected timeframe, change the query to read:  (Cameron D thanks!)

*query = "select datetime, barometer from archive where datetime > %.0f and 
datetime < %.0f and barometer is not null order by dateTime;" % 
(start_time, stop_time)*




[image: hunga_tonga.png]

If you want the bars closer to the rise and falls of the events, need to 
adjust the speed of sound slightly.
On Saturday, January 22, 2022 at 2:37:09 PM UTC-5 pmcg...@gmail.com wrote:

> WOW!  This is some interesting data, here is my location in Northern 
> Utah.  Looks like the reverse may be a little off in calculation but this 
> made it easy to find instead of hunting through the data.
>
> Great Work!
> [image: hunga_tonga.png]
> On Saturday, January 22, 2022 at 12:16:45 PM UTC-7 morr...@gmail.com 
> wrote:
>
>> Did an update to my script at: 
>> https://github.com/morrowwm/weewx_tonga_browse
>>
>> Mostly incorporating additions from Cameron (thanks!)
>>
>> All parameters you likely want to set are near the top of the script.
>>
>>1. support for mysql (untested, I don't have a mysql based weewx 
>>installation)
>>2. calculation and display of all three initial arrival, arrival from 
>>opposite direction, and second arrival after one trip around the globe
>>3. highlighting of the three events with grey bars
>>4. cubic spline curve fit of raw data and use of that fit to remove 
>>the base pressure variations. The new smoothing_hours parameter can be 
>> used 
>>to control how close the fit is. 
>>5. changed the display of data to highlight the extracted events and 
>>subdue the original data, other cosmetic changes
>>
>> I had a data outage about 26 hours after the event, we're quite a 
>> distance from Tonga, plus a major storm was clearing out in our area. So 
>> not obviously anything unusual happened.
>>
>> Some scientist might be interested in the arrival times of all this data, 
>> though.
>> [image: hunga_tonga.png]
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/80a10960-7af0-44ec-9fd8-bb0a9cf74e55n%40googlegroups.com.


Re: [weewx-user] When did the blast wave of the eruption "hit" your station? - extract your data

2022-01-22 Thread morr...@gmail.com
The curve fit (solid black line) isn't matching your data (turquoise dots) 
really well. Try reducing smoothing_hours to maybe 12, or 6. 

The true model to estimate arrival times accurately is probably a lot more 
complicated than time = distance / constant_velocity. 

On Saturday, January 22, 2022 at 3:37:09 p.m. UTC-4 pmcg...@gmail.com wrote:

> WOW!  This is some interesting data, here is my location in Northern 
> Utah.  Looks like the reverse may be a little off in calculation but this 
> made it easy to find instead of hunting through the data.
>
> Great Work!
> [image: hunga_tonga.png]
> On Saturday, January 22, 2022 at 12:16:45 PM UTC-7 morr...@gmail.com 
> wrote:
>
>> Did an update to my script at: 
>> https://github.com/morrowwm/weewx_tonga_browse
>>
>> Mostly incorporating additions from Cameron (thanks!)
>>
>> All parameters you likely want to set are near the top of the script.
>>
>>1. support for mysql (untested, I don't have a mysql based weewx 
>>installation)
>>2. calculation and display of all three initial arrival, arrival from 
>>opposite direction, and second arrival after one trip around the globe
>>3. highlighting of the three events with grey bars
>>4. cubic spline curve fit of raw data and use of that fit to remove 
>>the base pressure variations. The new smoothing_hours parameter can be 
>> used 
>>to control how close the fit is. 
>>5. changed the display of data to highlight the extracted events and 
>>subdue the original data, other cosmetic changes
>>
>> I had a data outage about 26 hours after the event, we're quite a 
>> distance from Tonga, plus a major storm was clearing out in our area. So 
>> not obviously anything unusual happened.
>>
>> Some scientist might be interested in the arrival times of all this data, 
>> though.
>> [image: hunga_tonga.png]
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/5d379045-e055-4643-afd0-2693aac5133fn%40googlegroups.com.


Re: [weewx-user] When did the blast wave of the eruption "hit" your station? - extract your data

2022-01-22 Thread pmcg...@gmail.com
WOW!  This is some interesting data, here is my location in Northern Utah.  
Looks like the reverse may be a little off in calculation but this made it 
easy to find instead of hunting through the data.

Great Work!
[image: hunga_tonga.png]
On Saturday, January 22, 2022 at 12:16:45 PM UTC-7 morr...@gmail.com wrote:

> Did an update to my script at: 
> https://github.com/morrowwm/weewx_tonga_browse
>
> Mostly incorporating additions from Cameron (thanks!)
>
> All parameters you likely want to set are near the top of the script.
>
>1. support for mysql (untested, I don't have a mysql based weewx 
>installation)
>2. calculation and display of all three initial arrival, arrival from 
>opposite direction, and second arrival after one trip around the globe
>3. highlighting of the three events with grey bars
>4. cubic spline curve fit of raw data and use of that fit to remove 
>the base pressure variations. The new smoothing_hours parameter can be 
> used 
>to control how close the fit is. 
>5. changed the display of data to highlight the extracted events and 
>subdue the original data, other cosmetic changes
>
> I had a data outage about 26 hours after the event, we're quite a distance 
> from Tonga, plus a major storm was clearing out in our area. So not 
> obviously anything unusual happened.
>
> Some scientist might be interested in the arrival times of all this data, 
> though.
> [image: hunga_tonga.png]
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/9e6a893a-c4d2-4975-81c3-7835e5372073n%40googlegroups.com.


Re: [weewx-user] When did the blast wave of the eruption "hit" your station? - extract your data

2022-01-22 Thread morr...@gmail.com
Did an update to my script 
at: https://github.com/morrowwm/weewx_tonga_browse

Mostly incorporating additions from Cameron (thanks!)

All parameters you likely want to set are near the top of the script.

   1. support for mysql (untested, I don't have a mysql based weewx 
   installation)
   2. calculation and display of all three initial arrival, arrival from 
   opposite direction, and second arrival after one trip around the globe
   3. highlighting of the three events with grey bars
   4. cubic spline curve fit of raw data and use of that fit to remove the 
   base pressure variations. The new smoothing_hours parameter can be used to 
   control how close the fit is. 
   5. changed the display of data to highlight the extracted events and 
   subdue the original data, other cosmetic changes

I had a data outage about 26 hours after the event, we're quite a distance 
from Tonga, plus a major storm was clearing out in our area. So not 
obviously anything unusual happened.

Some scientist might be interested in the arrival times of all this data, 
though.
[image: hunga_tonga.png]

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/6e11ab35-5a24-4357-a90f-905706abe03cn%40googlegroups.com.


Re: [weewx-user] When did the blast wave of the eruption "hit" your station? - extract your data

2022-01-21 Thread Ted Frohling

Thanks very much for the new python script.  It works.

The other three files looked great as well.

They were all for Tucson, AZ, USA

ted


On 1/20/22 6:12 PM, 'Cameron D' via weewx-user wrote:

yes, definitely looks like there is no data.
I have attached another version of mine, in which the trend line is 
disabled by default, but I suspect that would just delay the 
inevitable and it would crash trying to do the plot.


I also fixed up a few plotting errors in my code to do with the 
mysteries (to me) of layer ordering.
I also had a background bar showing either side of expected arrival - 
in this version I have now changed that to start at the expected 
arrival and stop 1 hour later.


On Friday, 21 January 2022 at 3:29:36 am UTC+10 bgra...@umw.edu wrote:

Hello,
Not being a programmer, I probably shouldn't have messed with
this, but being curious...

I tried the code posted on github as well as the one by Cameron D.
In both cases I got the following error:
```
root@n4mrv:/home/bg/weewx_tonga_browse-main# python3 ./tonga.py
[file from Cameron D]

distance to eruption 12056.6 km arrival at 1642258360 (2022-01-15
09:52:39)
      opposite pulse arrival at 1642308921 (2022-01-15 23:55:21)
      second time around pulse arrival at 1642385471 (2022-01-16
21:11:10)
Traceback (most recent call last):
  File "./tonga.py", line 178, in 
    plot_burst( cursor, arrival_time, hour_span, "primary" )
  File "./tonga.py", line 54, in plot_burst
    coeff = np.polyfit(xdata, ydata, background_order )
  File "<__array_function__ internals>", line 180, in polyfit
  File
"/usr/local/lib/python3.8/dist-packages/numpy/lib/polynomial.py",
line 638, in polyfit
raise TypeError("expected non-empty vector for x")
TypeError: expected non-empty vector for x
```
I added my lat/lon information but may have missed something else
I need to change. Python modules were installed as directed. Copy
of weewx.sdb is in the same directory as the program.
Thanks.
Bob
On Wednesday, January 19, 2022 at 10:32:49 AM UTC-5
morr...@gmail.com wrote:

On Wednesday, January 19, 2022 at 12:42:04 a.m. UTC-4 Cameron
D wrote:

  * as you get closer to the equator, tidal changes
dominate the baseline in that timescale - I tried
higher order polynomials, but they are next to useless.

I also had little luck with higher order polynomials to remove
the general trend.

I've put the script here:
https://github.com/morrowwm/weewx_tonga_browse

--
You received this message because you are subscribed to the Google 
Groups "weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/71655988-a5d6-4771-bb56-12fa455f24f2n%40googlegroups.com 
.


--
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/f667e702-0e2d-61a7-1e18-74bc6916ecb3%40gmail.com.


Re: [weewx-user] When did the blast wave of the eruption "hit" your station? - extract your data

2022-01-21 Thread paul.ba...@gmail.com
Hello,
I did a little experience using LOWESS (also called  LOESS in some places) 
with success I think. In my experience it is the best method I tried over 
the years.
This non parametric local smoothing exists for many lingages including 
Fortran (which I used...), C, Python, R etc.
It use three parameters: a smoothing factor, adjusted between 0 and 1. You 
have to experiment to find the best according to your problem. In my case 
.03 was good.. the second is the number of iterations, 1 to...; I adopted 
2, the doc says any larger number will not change antthing; the last one is 
a speed-up factor; I choose 0 (= No Speed-Up). With 3639 data points, the 
processing time is barely seen (10 years old Intel i3770 processor). 

The upper pannel represent the original data in blue and the smoothed one 
on red.
The lower pannel represent the difference between the original data and the 
smoothed one.
The time (T) is given in days, starting at 0:00:00 UTC on January 15th. The 
last point is at 24:00:00 on January 18th.
The vertical axis is in mbar. My altitude is 410 meters.

The first and second pulses are very clearely visible. There are a few 
other signals needing interpretation...  Also noticable is the smoother 
signal before the first spike compared to the rest of the data.
Have a nice week-end, Paul
Le Friday, January 21, 2022 à 4:38:59 PM UTC+1, bgra...@umw.edu a écrit :

> Thanks all, bad copy of weewx.sdb. All is well.
>
> On Thursday, January 20, 2022 at 5:25:50 PM UTC-5 morr...@gmail.com wrote:
>
>> It looks like you retrieved no data. It calculated decent looking arrival 
>> times, so no problem with the change you made?
>>
>> Try just a query for data spanning the first arrival. From a shell prompt:
>>
>> sqlite3 weewx.sdb "select datetime, barometer from archive where datetime 
>> > 1642258360-10 and datetime < 1642258360+10 order by dateTime;"
>>
>>
>> On Thursday, January 20, 2022 at 1:29:36 p.m. UTC-4 bgra...@umw.edu 
>> wrote:
>>
>>> I tried the code posted on github as well as the one by Cameron D. In 
>>> both cases I got the following error:
>>> ```
>>> root@n4mrv:/home/bg/weewx_tonga_browse-main# python3 ./tonga.py   [file 
>>> from Cameron D]
>>>
>>> distance to eruption 12056.6 km arrival at 1642258360 (2022-01-15 
>>> 09:52:39)
>>>   opposite pulse arrival at 1642308921 (2022-01-15 23:55:21)
>>>   second time around pulse arrival at 1642385471 (2022-01-16 
>>> 21:11:10)
>>> Traceback (most recent call last):
>>>   File "./tonga.py", line 178, in 
>>> plot_burst( cursor, arrival_time, hour_span, "primary" )
>>>   File "./tonga.py", line 54, in plot_burst
>>> coeff = np.polyfit(xdata, ydata, background_order )
>>>   File "<__array_function__ internals>", line 180, in polyfit
>>>   File "/usr/local/lib/python3.8/dist-packages/numpy/lib/polynomial.py", 
>>> line 638, in polyfit
>>> raise TypeError("expected non-empty vector for x")
>>> TypeError: expected non-empty vector for x
>>> ```
>>> I added my lat/lon information but may have missed something else I need 
>>> to change. Python modules were installed as directed. Copy of weewx.sdb is 
>>> in the same directory as the program.
>>> Thanks.
>>> Bob
>>> On Wednesday, January 19, 2022 at 10:32:49 AM UTC-5 morr...@gmail.com 
>>> wrote:
>>>
 On Wednesday, January 19, 2022 at 12:42:04 a.m. UTC-4 Cameron D wrote:

>
>- as you get closer to the equator, tidal changes dominate the 
>baseline in that timescale - I tried higher order polynomials, but 
> they are 
>next to useless.
>
> I also had little luck with higher order polynomials to remove the 
 general trend.

 I've put the script here: 
 https://github.com/morrowwm/weewx_tonga_browse

>>>

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/b0bbb6da-9267-4aa2-a6de-c3c089c2d5dan%40googlegroups.com.


Tonga-1.pdf
Description: Adobe PDF document


Re: [weewx-user] When did the blast wave of the eruption "hit" your station? - extract your data

2022-01-21 Thread bgra...@umw.edu
Thanks all, bad copy of weewx.sdb. All is well.

On Thursday, January 20, 2022 at 5:25:50 PM UTC-5 morr...@gmail.com wrote:

> It looks like you retrieved no data. It calculated decent looking arrival 
> times, so no problem with the change you made?
>
> Try just a query for data spanning the first arrival. From a shell prompt:
>
> sqlite3 weewx.sdb "select datetime, barometer from archive where datetime 
> > 1642258360-10 and datetime < 1642258360+10 order by dateTime;"
>
>
> On Thursday, January 20, 2022 at 1:29:36 p.m. UTC-4 bgra...@umw.edu wrote:
>
>> I tried the code posted on github as well as the one by Cameron D. In 
>> both cases I got the following error:
>> ```
>> root@n4mrv:/home/bg/weewx_tonga_browse-main# python3 ./tonga.py   [file 
>> from Cameron D]
>>
>> distance to eruption 12056.6 km arrival at 1642258360 (2022-01-15 
>> 09:52:39)
>>   opposite pulse arrival at 1642308921 (2022-01-15 23:55:21)
>>   second time around pulse arrival at 1642385471 (2022-01-16 21:11:10)
>> Traceback (most recent call last):
>>   File "./tonga.py", line 178, in 
>> plot_burst( cursor, arrival_time, hour_span, "primary" )
>>   File "./tonga.py", line 54, in plot_burst
>> coeff = np.polyfit(xdata, ydata, background_order )
>>   File "<__array_function__ internals>", line 180, in polyfit
>>   File "/usr/local/lib/python3.8/dist-packages/numpy/lib/polynomial.py", 
>> line 638, in polyfit
>> raise TypeError("expected non-empty vector for x")
>> TypeError: expected non-empty vector for x
>> ```
>> I added my lat/lon information but may have missed something else I need 
>> to change. Python modules were installed as directed. Copy of weewx.sdb is 
>> in the same directory as the program.
>> Thanks.
>> Bob
>> On Wednesday, January 19, 2022 at 10:32:49 AM UTC-5 morr...@gmail.com 
>> wrote:
>>
>>> On Wednesday, January 19, 2022 at 12:42:04 a.m. UTC-4 Cameron D wrote:
>>>

- as you get closer to the equator, tidal changes dominate the 
baseline in that timescale - I tried higher order polynomials, but they 
 are 
next to useless.

 I also had little luck with higher order polynomials to remove the 
>>> general trend.
>>>
>>> I've put the script here: https://github.com/morrowwm/weewx_tonga_browse
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/27166f36-0ac5-43aa-a41d-abd2afe267f3n%40googlegroups.com.


Re: [weewx-user] When did the blast wave of the eruption "hit" your station? - extract your data

2022-01-20 Thread 'Cameron D' via weewx-user
I don't understand the physics of it. As per the last few postings the 
speed of sound may be variable enough to show up here.

I would just tinker with the speed of sound parameter and see if you can 
make all peaks look sensible. At least you have data at a good frequency.



On Friday, 21 January 2022 at 4:21:36 pm UTC+10 ti...@skybase.net wrote:

> Hi Cameron,
>
> Beut! - that worked a treat - thanks :)
>
> I've also noticed that the return pulse highlight appears to be off, see 
> pic below. Or is it meant to be like that ?
>
> thanks
>
> Tim
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/700bfa67-e531-4906-85d0-2ef9c9f88206n%40googlegroups.com.


Re: [weewx-user] When did the blast wave of the eruption "hit" your station? - extract your data

2022-01-20 Thread 'Cameron D' via weewx-user
I assume your DB is storing in US units - mine is metricWX (I knew one day 
it would be useful to have done that!)
One easy way is to modify the queries yourself - where the  query (2 
queries in my code)  specifies "barometer", replace with 
"barometer * 33.8639 as barometer"

On Friday, 21 January 2022 at 3:36:31 pm UTC+10 ti...@skybase.net wrote:

> Hi all,
>
> The script works well on my data but the pressure readout is in inHg 
> rather than hPa. 
>
> Can an option be inserted to have hPa computed before plotting ?
>
> thanks
>
> Tim
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/a6b52952-3ace-4a2c-91f6-b71d5611b7cdn%40googlegroups.com.


Re: [weewx-user] When did the blast wave of the eruption "hit" your station? - extract your data

2022-01-20 Thread storm...@gmail.com
If I recall looking @ MADIS 15 minute data, it least for me, the pressure 
of the opposite wave did drop a some before the major spike. After changing 
the colors on the charts, it aligns with the first drop in pressure.

On Thursday, January 20, 2022 at 11:28:41 PM UTC-5 Cameron D wrote:

> There are certainly uncertainties in the barometric data timings. My 
> system is probably a worst case - it only reports a value every 15 minutes, 
> and I don't know if that is an average of the previous 15 minutes or just a 
> snapshot reading at the transition time. So for me 20 minutes is within the 
> uncertainty.
> Also, I don't know if it is expected, but the  pulses that travelled 
> further show only the negative part, which comes after the positive. So 
> there is extra lag in that.
>
> I derived a speed by fitting data to Australian bureau charts, and they 
> only show 30 minute samples, so my speed is hardly definitive.  I would 
> expect it to vary a bit around the globe.  The average speed I derived from 
> the first peak alone was 0.30 m/s, so that is either an indicator of the 
> uncertainty in the fitting or that the average speed increased as it 
> progressed.
> On Friday, 21 January 2022 at 2:05:49 pm UTC+10 storm...@gmail.com wrote:
>
>> Yes, the image files are being produced. Only thing I noticed was the 
>> arrival time for the opposite pulse is off by approx. 20 minutes according 
>> to the actual PWS data, this could be due to the wave speeding up or 
>> slowing down as it made its way around the globe.  Right now I'm using your 
>> default settings.
>>
>> On Thursday, January 20, 2022 at 10:40:36 PM UTC-5 Cameron D wrote:
>>
>>> the RankWarning is just a warning, you should still have image files 
>>> produced.  I expect the polyfit it just ignores higher order terms and just 
>>> returns a quadratic.
>>>
>>> That is because the polynomial is a poor representation of the 
>>> background, and the spline fit works better, if you get the parameters 
>>> correct.
>>>
>>> Initially you are better just to view the results without trend 
>>> removal.  If the peaks  do not stand out then  background removal is 
>>> unlikely to help much.
>>> Also, with my code,  make sure you start with oversampling set to 1. 
>>> Only adjust it if you see a stair-step effect.
>>>
>>> On Friday, 21 January 2022 at 1:09:28 pm UTC+10 storm...@gmail.com 
>>> wrote:
>>>
 Modified the query and added the print statement as suggested 
 by Cameron D and here are the results:

 *Morrowwn Script:*

 raspberrypi:~/Desktop/Tonga $ python3 tonga_barometer.py
 distance to eruption 13293.9 km arrival at 1642261629 (2022-01-15 
 10:47:08)
 select datetime, barometer from archive where datetime > 1642172400 and 
 datetime < 1642693629 order by dateTime;
 Traceback (most recent call last):
   File "tonga_barometer.py", line 47, in 
 coeff = np.polyfit(xdata, ydata, 2)
   File "/usr/lib/python3/dist-packages/numpy/lib/polynomial.py", line 
 590, in polyfit
 y = NX.asarray(y) + 0.0
 TypeError: unsupported operand type(s) for +: 'NoneType' and 'float'


 *Cameron D Script*:

 raspberrypi:~/Desktop/Tonga $ python3 tonga_baro.py
 distance to eruption 12255.7 km arrival at 1642258384 (2022-01-15 
 09:53:04)
   opposite pulse arrival at 1642306911 (2022-01-15 23:21:50)
   second time around pulse arrival at 1642383509 (2022-01-16 
 20:38:29)
 query returned 96 data points
 query returned 96 data points
 query returned 95 data points
 tonga_baro.py:108: RankWarning: Polyfit may be poorly conditioned
   coeff = np.polyfit(xdata, ydata, 5 )

 Note: LAT/Long and speed of sound are identical in both scripts.
 On Thursday, January 20, 2022 at 9:27:13 PM UTC-5 Cameron D wrote:

> and add a debug printout for how many result lines there are after ...
> result = cursor.fetchall()
> add the line:
> 
> *print( "query returned {} data points".format(len(result)))*
>
> On Friday, 21 January 2022 at 12:21:59 pm UTC+10 Cameron D wrote:
>
>> To eliminate NULL data points use a query like:
>> select datetime, barometer from archive where datetime > 1642172400 
>> and datetime < 1642693629* and barometer is not null *order by 
>> dateTime;
>>  You could add the part in bold into the query in the python script.
>>
>> Of course, if they are all null...
>>
>> On Friday, 21 January 2022 at 12:14:44 pm UTC+10 storm...@gmail.com 
>> wrote:
>>
>>> Download the latest script from 
>>> https://github.com/morrowwm/weewx_tonga_browse. Beside installing 
>>> the Python Modules Vince stated above, I needed to also install  
>>> python3-scipy. I do have data between 1642172400 and 1642693629; 
>>> except for a couple "null" in that time period.   So when I run the 
>>> script, 
>>> I get the following 

Re: [weewx-user] When did the blast wave of the eruption "hit" your station? - extract your data

2022-01-20 Thread 'Cameron D' via weewx-user
There are certainly uncertainties in the barometric data timings. My system 
is probably a worst case - it only reports a value every 15 minutes, and I 
don't know if that is an average of the previous 15 minutes or just a 
snapshot reading at the transition time. So for me 20 minutes is within the 
uncertainty.
Also, I don't know if it is expected, but the  pulses that travelled 
further show only the negative part, which comes after the positive. So 
there is extra lag in that.

I derived a speed by fitting data to Australian bureau charts, and they 
only show 30 minute samples, so my speed is hardly definitive.  I would 
expect it to vary a bit around the globe.  The average speed I derived from 
the first peak alone was 0.30 m/s, so that is either an indicator of the 
uncertainty in the fitting or that the average speed increased as it 
progressed.
On Friday, 21 January 2022 at 2:05:49 pm UTC+10 storm...@gmail.com wrote:

> Yes, the image files are being produced. Only thing I noticed was the 
> arrival time for the opposite pulse is off by approx. 20 minutes according 
> to the actual PWS data, this could be due to the wave speeding up or 
> slowing down as it made its way around the globe.  Right now I'm using your 
> default settings.
>
> On Thursday, January 20, 2022 at 10:40:36 PM UTC-5 Cameron D wrote:
>
>> the RankWarning is just a warning, you should still have image files 
>> produced.  I expect the polyfit it just ignores higher order terms and just 
>> returns a quadratic.
>>
>> That is because the polynomial is a poor representation of the 
>> background, and the spline fit works better, if you get the parameters 
>> correct.
>>
>> Initially you are better just to view the results without trend removal.  
>> If the peaks  do not stand out then  background removal is unlikely to help 
>> much.
>> Also, with my code,  make sure you start with oversampling set to 1. Only 
>> adjust it if you see a stair-step effect.
>>
>> On Friday, 21 January 2022 at 1:09:28 pm UTC+10 storm...@gmail.com wrote:
>>
>>> Modified the query and added the print statement as suggested by Cameron 
>>> D and here are the results:
>>>
>>> *Morrowwn Script:*
>>>
>>> raspberrypi:~/Desktop/Tonga $ python3 tonga_barometer.py
>>> distance to eruption 13293.9 km arrival at 1642261629 (2022-01-15 
>>> 10:47:08)
>>> select datetime, barometer from archive where datetime > 1642172400 and 
>>> datetime < 1642693629 order by dateTime;
>>> Traceback (most recent call last):
>>>   File "tonga_barometer.py", line 47, in 
>>> coeff = np.polyfit(xdata, ydata, 2)
>>>   File "/usr/lib/python3/dist-packages/numpy/lib/polynomial.py", line 
>>> 590, in polyfit
>>> y = NX.asarray(y) + 0.0
>>> TypeError: unsupported operand type(s) for +: 'NoneType' and 'float'
>>>
>>>
>>> *Cameron D Script*:
>>>
>>> raspberrypi:~/Desktop/Tonga $ python3 tonga_baro.py
>>> distance to eruption 12255.7 km arrival at 1642258384 (2022-01-15 
>>> 09:53:04)
>>>   opposite pulse arrival at 1642306911 (2022-01-15 23:21:50)
>>>   second time around pulse arrival at 1642383509 (2022-01-16 
>>> 20:38:29)
>>> query returned 96 data points
>>> query returned 96 data points
>>> query returned 95 data points
>>> tonga_baro.py:108: RankWarning: Polyfit may be poorly conditioned
>>>   coeff = np.polyfit(xdata, ydata, 5 )
>>>
>>> Note: LAT/Long and speed of sound are identical in both scripts.
>>> On Thursday, January 20, 2022 at 9:27:13 PM UTC-5 Cameron D wrote:
>>>
 and add a debug printout for how many result lines there are after ...
 result = cursor.fetchall()
 add the line:
 
 *print( "query returned {} data points".format(len(result)))*

 On Friday, 21 January 2022 at 12:21:59 pm UTC+10 Cameron D wrote:

> To eliminate NULL data points use a query like:
> select datetime, barometer from archive where datetime > 1642172400 
> and datetime < 1642693629* and barometer is not null *order by 
> dateTime;
>  You could add the part in bold into the query in the python script.
>
> Of course, if they are all null...
>
> On Friday, 21 January 2022 at 12:14:44 pm UTC+10 storm...@gmail.com 
> wrote:
>
>> Download the latest script from 
>> https://github.com/morrowwm/weewx_tonga_browse. Beside installing 
>> the Python Modules Vince stated above, I needed to also install  
>> python3-scipy. I do have data between 1642172400 and 1642693629; 
>> except for a couple "null" in that time period.   So when I run the 
>> script, 
>> I get the following error.
>>
>> raspberrypi:~/Desktop/Tonga $ python3 tonga_barometer.py
>> distance to eruption 13293.9 km arrival at 1642261629 (2022-01-15 
>> 10:47:08)
>> select datetime, barometer from archive where datetime > 1642172400 
>> and datetime < 1642693629 order by dateTime;
>> Traceback (most recent call last):
>>   File "tonga_barometer.py", line 47, in 
>> coeff = 

Re: [weewx-user] When did the blast wave of the eruption "hit" your station? - extract your data

2022-01-20 Thread storm...@gmail.com
Yes, the image files are being produced. Only thing I noticed was the 
arrival time for the opposite pulse is off by approx. 20 minutes according 
to the actual PWS data, this could be due to the wave speeding up or 
slowing down as it made its way around the globe.  Right now I'm using your 
default settings.

On Thursday, January 20, 2022 at 10:40:36 PM UTC-5 Cameron D wrote:

> the RankWarning is just a warning, you should still have image files 
> produced.  I expect the polyfit it just ignores higher order terms and just 
> returns a quadratic.
>
> That is because the polynomial is a poor representation of the background, 
> and the spline fit works better, if you get the parameters correct.
>
> Initially you are better just to view the results without trend removal.  
> If the peaks  do not stand out then  background removal is unlikely to help 
> much.
> Also, with my code,  make sure you start with oversampling set to 1. Only 
> adjust it if you see a stair-step effect.
>
> On Friday, 21 January 2022 at 1:09:28 pm UTC+10 storm...@gmail.com wrote:
>
>> Modified the query and added the print statement as suggested by Cameron 
>> D and here are the results:
>>
>> *Morrowwn Script:*
>>
>> raspberrypi:~/Desktop/Tonga $ python3 tonga_barometer.py
>> distance to eruption 13293.9 km arrival at 1642261629 (2022-01-15 
>> 10:47:08)
>> select datetime, barometer from archive where datetime > 1642172400 and 
>> datetime < 1642693629 order by dateTime;
>> Traceback (most recent call last):
>>   File "tonga_barometer.py", line 47, in 
>> coeff = np.polyfit(xdata, ydata, 2)
>>   File "/usr/lib/python3/dist-packages/numpy/lib/polynomial.py", line 
>> 590, in polyfit
>> y = NX.asarray(y) + 0.0
>> TypeError: unsupported operand type(s) for +: 'NoneType' and 'float'
>>
>>
>> *Cameron D Script*:
>>
>> raspberrypi:~/Desktop/Tonga $ python3 tonga_baro.py
>> distance to eruption 12255.7 km arrival at 1642258384 (2022-01-15 
>> 09:53:04)
>>   opposite pulse arrival at 1642306911 (2022-01-15 23:21:50)
>>   second time around pulse arrival at 1642383509 (2022-01-16 20:38:29)
>> query returned 96 data points
>> query returned 96 data points
>> query returned 95 data points
>> tonga_baro.py:108: RankWarning: Polyfit may be poorly conditioned
>>   coeff = np.polyfit(xdata, ydata, 5 )
>>
>> Note: LAT/Long and speed of sound are identical in both scripts.
>> On Thursday, January 20, 2022 at 9:27:13 PM UTC-5 Cameron D wrote:
>>
>>> and add a debug printout for how many result lines there are after ...
>>> result = cursor.fetchall()
>>> add the line:
>>> 
>>> *print( "query returned {} data points".format(len(result)))*
>>>
>>> On Friday, 21 January 2022 at 12:21:59 pm UTC+10 Cameron D wrote:
>>>
 To eliminate NULL data points use a query like:
 select datetime, barometer from archive where datetime > 1642172400 and 
 datetime < 1642693629* and barometer is not null *order by dateTime;
  You could add the part in bold into the query in the python script.

 Of course, if they are all null...

 On Friday, 21 January 2022 at 12:14:44 pm UTC+10 storm...@gmail.com 
 wrote:

> Download the latest script from 
> https://github.com/morrowwm/weewx_tonga_browse. Beside installing the 
> Python Modules Vince stated above, I needed to also install  
> python3-scipy. I do have data between 1642172400 and 1642693629; 
> except for a couple "null" in that time period.   So when I run the 
> script, 
> I get the following error.
>
> raspberrypi:~/Desktop/Tonga $ python3 tonga_barometer.py
> distance to eruption 13293.9 km arrival at 1642261629 (2022-01-15 
> 10:47:08)
> select datetime, barometer from archive where datetime > 1642172400 
> and datetime < 1642693629 order by dateTime;
> Traceback (most recent call last):
>   File "tonga_barometer.py", line 47, in 
> coeff = np.polyfit(xdata, ydata, 2)
>   File "/usr/lib/python3/dist-packages/numpy/lib/polynomial.py", line 
> 590, in polyfit
> y = NX.asarray(y) + 0.0
> TypeError: unsupported operand type(s) for +: 'NoneType' and 'float'
>
> There should be a way to check for "null" data within the time period.
> On Thursday, January 20, 2022 at 8:12:55 PM UTC-5 Cameron D wrote:
>
>> yes, definitely looks like there is no data.
>> I have attached another version of mine, in which the trend line is 
>> disabled by default, but I suspect that would just delay the inevitable 
>> and 
>> it would crash trying to do the plot.
>>
>> I also fixed up a few plotting errors in my code to do with the 
>> mysteries (to me) of layer ordering.
>> I also had a background bar showing either side of expected arrival - 
>> in this version I have now changed that to start at the expected arrival 
>> and stop 1 hour later.
>>
>> On Friday, 21 January 2022 at 3:29:36 am UTC+10 bgra...@umw.edu 
>> 

Re: [weewx-user] When did the blast wave of the eruption "hit" your station? - extract your data

2022-01-20 Thread 'Cameron D' via weewx-user
the RankWarning is just a warning, you should still have image files 
produced.  I expect the polyfit it just ignores higher order terms and just 
returns a quadratic.

That is because the polynomial is a poor representation of the background, 
and the spline fit works better, if you get the parameters correct.

Initially you are better just to view the results without trend removal.  
If the peaks  do not stand out then  background removal is unlikely to help 
much.
Also, with my code,  make sure you start with oversampling set to 1. Only 
adjust it if you see a stair-step effect.

On Friday, 21 January 2022 at 1:09:28 pm UTC+10 storm...@gmail.com wrote:

> Modified the query and added the print statement as suggested by Cameron D 
> and here are the results:
>
> *Morrowwn Script:*
>
> raspberrypi:~/Desktop/Tonga $ python3 tonga_barometer.py
> distance to eruption 13293.9 km arrival at 1642261629 (2022-01-15 10:47:08)
> select datetime, barometer from archive where datetime > 1642172400 and 
> datetime < 1642693629 order by dateTime;
> Traceback (most recent call last):
>   File "tonga_barometer.py", line 47, in 
> coeff = np.polyfit(xdata, ydata, 2)
>   File "/usr/lib/python3/dist-packages/numpy/lib/polynomial.py", line 590, 
> in polyfit
> y = NX.asarray(y) + 0.0
> TypeError: unsupported operand type(s) for +: 'NoneType' and 'float'
>
>
> *Cameron D Script*:
>
> raspberrypi:~/Desktop/Tonga $ python3 tonga_baro.py
> distance to eruption 12255.7 km arrival at 1642258384 (2022-01-15 09:53:04)
>   opposite pulse arrival at 1642306911 (2022-01-15 23:21:50)
>   second time around pulse arrival at 1642383509 (2022-01-16 20:38:29)
> query returned 96 data points
> query returned 96 data points
> query returned 95 data points
> tonga_baro.py:108: RankWarning: Polyfit may be poorly conditioned
>   coeff = np.polyfit(xdata, ydata, 5 )
>
> Note: LAT/Long and speed of sound are identical in both scripts.
> On Thursday, January 20, 2022 at 9:27:13 PM UTC-5 Cameron D wrote:
>
>> and add a debug printout for how many result lines there are after ...
>> result = cursor.fetchall()
>> add the line:
>> 
>> *print( "query returned {} data points".format(len(result)))*
>>
>> On Friday, 21 January 2022 at 12:21:59 pm UTC+10 Cameron D wrote:
>>
>>> To eliminate NULL data points use a query like:
>>> select datetime, barometer from archive where datetime > 1642172400 and 
>>> datetime < 1642693629* and barometer is not null *order by dateTime;
>>>  You could add the part in bold into the query in the python script.
>>>
>>> Of course, if they are all null...
>>>
>>> On Friday, 21 January 2022 at 12:14:44 pm UTC+10 storm...@gmail.com 
>>> wrote:
>>>
 Download the latest script from 
 https://github.com/morrowwm/weewx_tonga_browse. Beside installing the 
 Python Modules Vince stated above, I needed to also install  
 python3-scipy. I do have data between 1642172400 and 1642693629; 
 except for a couple "null" in that time period.   So when I run the 
 script, 
 I get the following error.

 raspberrypi:~/Desktop/Tonga $ python3 tonga_barometer.py
 distance to eruption 13293.9 km arrival at 1642261629 (2022-01-15 
 10:47:08)
 select datetime, barometer from archive where datetime > 1642172400 and 
 datetime < 1642693629 order by dateTime;
 Traceback (most recent call last):
   File "tonga_barometer.py", line 47, in 
 coeff = np.polyfit(xdata, ydata, 2)
   File "/usr/lib/python3/dist-packages/numpy/lib/polynomial.py", line 
 590, in polyfit
 y = NX.asarray(y) + 0.0
 TypeError: unsupported operand type(s) for +: 'NoneType' and 'float'

 There should be a way to check for "null" data within the time period.
 On Thursday, January 20, 2022 at 8:12:55 PM UTC-5 Cameron D wrote:

> yes, definitely looks like there is no data.
> I have attached another version of mine, in which the trend line is 
> disabled by default, but I suspect that would just delay the inevitable 
> and 
> it would crash trying to do the plot.
>
> I also fixed up a few plotting errors in my code to do with the 
> mysteries (to me) of layer ordering.
> I also had a background bar showing either side of expected arrival - 
> in this version I have now changed that to start at the expected arrival 
> and stop 1 hour later.
>
> On Friday, 21 January 2022 at 3:29:36 am UTC+10 bgra...@umw.edu wrote:
>
>> Hello,
>> Not being a programmer, I probably shouldn't have messed with this, 
>> but being curious...
>>
>> I tried the code posted on github as well as the one by Cameron D. In 
>> both cases I got the following error:
>> ```
>> root@n4mrv:/home/bg/weewx_tonga_browse-main# python3 ./tonga.py   [file 
>> from Cameron D]
>>
>> distance to eruption 12056.6 km arrival at 1642258360 (2022-01-15 
>> 09:52:39)
>>   opposite pulse arrival at 

Re: [weewx-user] When did the blast wave of the eruption "hit" your station? - extract your data

2022-01-20 Thread storm...@gmail.com
Modified the query and added the print statement as suggested by Cameron D 
and here are the results:

*Morrowwn Script:*

raspberrypi:~/Desktop/Tonga $ python3 tonga_barometer.py
distance to eruption 13293.9 km arrival at 1642261629 (2022-01-15 10:47:08)
select datetime, barometer from archive where datetime > 1642172400 and 
datetime < 1642693629 order by dateTime;
Traceback (most recent call last):
  File "tonga_barometer.py", line 47, in 
coeff = np.polyfit(xdata, ydata, 2)
  File "/usr/lib/python3/dist-packages/numpy/lib/polynomial.py", line 590, 
in polyfit
y = NX.asarray(y) + 0.0
TypeError: unsupported operand type(s) for +: 'NoneType' and 'float'


*Cameron D Script*:

raspberrypi:~/Desktop/Tonga $ python3 tonga_baro.py
distance to eruption 12255.7 km arrival at 1642258384 (2022-01-15 09:53:04)
  opposite pulse arrival at 1642306911 (2022-01-15 23:21:50)
  second time around pulse arrival at 1642383509 (2022-01-16 20:38:29)
query returned 96 data points
query returned 96 data points
query returned 95 data points
tonga_baro.py:108: RankWarning: Polyfit may be poorly conditioned
  coeff = np.polyfit(xdata, ydata, 5 )

Note: LAT/Long and speed of sound are identical in both scripts.
On Thursday, January 20, 2022 at 9:27:13 PM UTC-5 Cameron D wrote:

> and add a debug printout for how many result lines there are after ...
> result = cursor.fetchall()
> add the line:
> 
> *print( "query returned {} data points".format(len(result)))*
>
> On Friday, 21 January 2022 at 12:21:59 pm UTC+10 Cameron D wrote:
>
>> To eliminate NULL data points use a query like:
>> select datetime, barometer from archive where datetime > 1642172400 and 
>> datetime < 1642693629* and barometer is not null *order by dateTime;
>>  You could add the part in bold into the query in the python script.
>>
>> Of course, if they are all null...
>>
>> On Friday, 21 January 2022 at 12:14:44 pm UTC+10 storm...@gmail.com 
>> wrote:
>>
>>> Download the latest script from 
>>> https://github.com/morrowwm/weewx_tonga_browse. Beside installing the 
>>> Python Modules Vince stated above, I needed to also install  
>>> python3-scipy. I do have data between 1642172400 and 1642693629; except 
>>> for a couple "null" in that time period.   So when I run the script, I get 
>>> the following error.
>>>
>>> raspberrypi:~/Desktop/Tonga $ python3 tonga_barometer.py
>>> distance to eruption 13293.9 km arrival at 1642261629 (2022-01-15 
>>> 10:47:08)
>>> select datetime, barometer from archive where datetime > 1642172400 and 
>>> datetime < 1642693629 order by dateTime;
>>> Traceback (most recent call last):
>>>   File "tonga_barometer.py", line 47, in 
>>> coeff = np.polyfit(xdata, ydata, 2)
>>>   File "/usr/lib/python3/dist-packages/numpy/lib/polynomial.py", line 
>>> 590, in polyfit
>>> y = NX.asarray(y) + 0.0
>>> TypeError: unsupported operand type(s) for +: 'NoneType' and 'float'
>>>
>>> There should be a way to check for "null" data within the time period.
>>> On Thursday, January 20, 2022 at 8:12:55 PM UTC-5 Cameron D wrote:
>>>
 yes, definitely looks like there is no data.
 I have attached another version of mine, in which the trend line is 
 disabled by default, but I suspect that would just delay the inevitable 
 and 
 it would crash trying to do the plot.

 I also fixed up a few plotting errors in my code to do with the 
 mysteries (to me) of layer ordering.
 I also had a background bar showing either side of expected arrival - 
 in this version I have now changed that to start at the expected arrival 
 and stop 1 hour later.

 On Friday, 21 January 2022 at 3:29:36 am UTC+10 bgra...@umw.edu wrote:

> Hello,
> Not being a programmer, I probably shouldn't have messed with this, 
> but being curious...
>
> I tried the code posted on github as well as the one by Cameron D. In 
> both cases I got the following error:
> ```
> root@n4mrv:/home/bg/weewx_tonga_browse-main# python3 ./tonga.py   [file 
> from Cameron D]
>
> distance to eruption 12056.6 km arrival at 1642258360 (2022-01-15 
> 09:52:39)
>   opposite pulse arrival at 1642308921 (2022-01-15 23:55:21)
>   second time around pulse arrival at 1642385471 (2022-01-16 
> 21:11:10)
> Traceback (most recent call last):
>   File "./tonga.py", line 178, in 
> plot_burst( cursor, arrival_time, hour_span, "primary" )
>   File "./tonga.py", line 54, in plot_burst
> coeff = np.polyfit(xdata, ydata, background_order )
>   File "<__array_function__ internals>", line 180, in polyfit
>   File 
> "/usr/local/lib/python3.8/dist-packages/numpy/lib/polynomial.py", line 
> 638, 
> in polyfit
> raise TypeError("expected non-empty vector for x")
> TypeError: expected non-empty vector for x
> ```
> I added my lat/lon information but may have missed something else I 
> need to change. Python 

Re: [weewx-user] When did the blast wave of the eruption "hit" your station? - extract your data

2022-01-20 Thread 'Cameron D' via weewx-user
and add a debug printout for how many result lines there are after ...
result = cursor.fetchall()
add the line:

*print( "query returned {} data points".format(len(result)))*

On Friday, 21 January 2022 at 12:21:59 pm UTC+10 Cameron D wrote:

> To eliminate NULL data points use a query like:
> select datetime, barometer from archive where datetime > 1642172400 and 
> datetime < 1642693629* and barometer is not null *order by dateTime;
>  You could add the part in bold into the query in the python script.
>
> Of course, if they are all null...
>
> On Friday, 21 January 2022 at 12:14:44 pm UTC+10 storm...@gmail.com wrote:
>
>> Download the latest script from 
>> https://github.com/morrowwm/weewx_tonga_browse. Beside installing the 
>> Python Modules Vince stated above, I needed to also install  
>> python3-scipy. I do have data between 1642172400 and 1642693629; except 
>> for a couple "null" in that time period.   So when I run the script, I get 
>> the following error.
>>
>> raspberrypi:~/Desktop/Tonga $ python3 tonga_barometer.py
>> distance to eruption 13293.9 km arrival at 1642261629 (2022-01-15 
>> 10:47:08)
>> select datetime, barometer from archive where datetime > 1642172400 and 
>> datetime < 1642693629 order by dateTime;
>> Traceback (most recent call last):
>>   File "tonga_barometer.py", line 47, in 
>> coeff = np.polyfit(xdata, ydata, 2)
>>   File "/usr/lib/python3/dist-packages/numpy/lib/polynomial.py", line 
>> 590, in polyfit
>> y = NX.asarray(y) + 0.0
>> TypeError: unsupported operand type(s) for +: 'NoneType' and 'float'
>>
>> There should be a way to check for "null" data within the time period.
>> On Thursday, January 20, 2022 at 8:12:55 PM UTC-5 Cameron D wrote:
>>
>>> yes, definitely looks like there is no data.
>>> I have attached another version of mine, in which the trend line is 
>>> disabled by default, but I suspect that would just delay the inevitable and 
>>> it would crash trying to do the plot.
>>>
>>> I also fixed up a few plotting errors in my code to do with the 
>>> mysteries (to me) of layer ordering.
>>> I also had a background bar showing either side of expected arrival - in 
>>> this version I have now changed that to start at the expected arrival and 
>>> stop 1 hour later.
>>>
>>> On Friday, 21 January 2022 at 3:29:36 am UTC+10 bgra...@umw.edu wrote:
>>>
 Hello,
 Not being a programmer, I probably shouldn't have messed with this, but 
 being curious...

 I tried the code posted on github as well as the one by Cameron D. In 
 both cases I got the following error:
 ```
 root@n4mrv:/home/bg/weewx_tonga_browse-main# python3 ./tonga.py   [file 
 from Cameron D]

 distance to eruption 12056.6 km arrival at 1642258360 (2022-01-15 
 09:52:39)
   opposite pulse arrival at 1642308921 (2022-01-15 23:55:21)
   second time around pulse arrival at 1642385471 (2022-01-16 
 21:11:10)
 Traceback (most recent call last):
   File "./tonga.py", line 178, in 
 plot_burst( cursor, arrival_time, hour_span, "primary" )
   File "./tonga.py", line 54, in plot_burst
 coeff = np.polyfit(xdata, ydata, background_order )
   File "<__array_function__ internals>", line 180, in polyfit
   File 
 "/usr/local/lib/python3.8/dist-packages/numpy/lib/polynomial.py", line 
 638, 
 in polyfit
 raise TypeError("expected non-empty vector for x")
 TypeError: expected non-empty vector for x
 ```
 I added my lat/lon information but may have missed something else I 
 need to change. Python modules were installed as directed. Copy of 
 weewx.sdb is in the same directory as the program.
 Thanks.
 Bob
 On Wednesday, January 19, 2022 at 10:32:49 AM UTC-5 morr...@gmail.com 
 wrote:

> On Wednesday, January 19, 2022 at 12:42:04 a.m. UTC-4 Cameron D wrote:
>
>>
>>- as you get closer to the equator, tidal changes dominate the 
>>baseline in that timescale - I tried higher order polynomials, but 
>> they are 
>>next to useless.
>>
>> I also had little luck with higher order polynomials to remove the 
> general trend.
>
> I've put the script here: 
> https://github.com/morrowwm/weewx_tonga_browse
>


-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/29f6da88-32e8-488c-ba98-348ca63c893cn%40googlegroups.com.


Re: [weewx-user] When did the blast wave of the eruption "hit" your station? - extract your data

2022-01-20 Thread 'Cameron D' via weewx-user
To eliminate NULL data points use a query like:
select datetime, barometer from archive where datetime > 1642172400 and 
datetime < 1642693629* and barometer is not null *order by dateTime;
 You could add the part in bold into the query in the python script.

Of course, if they are all null...

On Friday, 21 January 2022 at 12:14:44 pm UTC+10 storm...@gmail.com wrote:

> Download the latest script from 
> https://github.com/morrowwm/weewx_tonga_browse. Beside installing the 
> Python Modules Vince stated above, I needed to also install  
> python3-scipy. I do have data between 1642172400 and 1642693629; except 
> for a couple "null" in that time period.   So when I run the script, I get 
> the following error.
>
> raspberrypi:~/Desktop/Tonga $ python3 tonga_barometer.py
> distance to eruption 13293.9 km arrival at 1642261629 (2022-01-15 10:47:08)
> select datetime, barometer from archive where datetime > 1642172400 and 
> datetime < 1642693629 order by dateTime;
> Traceback (most recent call last):
>   File "tonga_barometer.py", line 47, in 
> coeff = np.polyfit(xdata, ydata, 2)
>   File "/usr/lib/python3/dist-packages/numpy/lib/polynomial.py", line 590, 
> in polyfit
> y = NX.asarray(y) + 0.0
> TypeError: unsupported operand type(s) for +: 'NoneType' and 'float'
>
> There should be a way to check for "null" data within the time period.
> On Thursday, January 20, 2022 at 8:12:55 PM UTC-5 Cameron D wrote:
>
>> yes, definitely looks like there is no data.
>> I have attached another version of mine, in which the trend line is 
>> disabled by default, but I suspect that would just delay the inevitable and 
>> it would crash trying to do the plot.
>>
>> I also fixed up a few plotting errors in my code to do with the mysteries 
>> (to me) of layer ordering.
>> I also had a background bar showing either side of expected arrival - in 
>> this version I have now changed that to start at the expected arrival and 
>> stop 1 hour later.
>>
>> On Friday, 21 January 2022 at 3:29:36 am UTC+10 bgra...@umw.edu wrote:
>>
>>> Hello,
>>> Not being a programmer, I probably shouldn't have messed with this, but 
>>> being curious...
>>>
>>> I tried the code posted on github as well as the one by Cameron D. In 
>>> both cases I got the following error:
>>> ```
>>> root@n4mrv:/home/bg/weewx_tonga_browse-main# python3 ./tonga.py   [file 
>>> from Cameron D]
>>>
>>> distance to eruption 12056.6 km arrival at 1642258360 (2022-01-15 
>>> 09:52:39)
>>>   opposite pulse arrival at 1642308921 (2022-01-15 23:55:21)
>>>   second time around pulse arrival at 1642385471 (2022-01-16 
>>> 21:11:10)
>>> Traceback (most recent call last):
>>>   File "./tonga.py", line 178, in 
>>> plot_burst( cursor, arrival_time, hour_span, "primary" )
>>>   File "./tonga.py", line 54, in plot_burst
>>> coeff = np.polyfit(xdata, ydata, background_order )
>>>   File "<__array_function__ internals>", line 180, in polyfit
>>>   File "/usr/local/lib/python3.8/dist-packages/numpy/lib/polynomial.py", 
>>> line 638, in polyfit
>>> raise TypeError("expected non-empty vector for x")
>>> TypeError: expected non-empty vector for x
>>> ```
>>> I added my lat/lon information but may have missed something else I need 
>>> to change. Python modules were installed as directed. Copy of weewx.sdb is 
>>> in the same directory as the program.
>>> Thanks.
>>> Bob
>>> On Wednesday, January 19, 2022 at 10:32:49 AM UTC-5 morr...@gmail.com 
>>> wrote:
>>>
 On Wednesday, January 19, 2022 at 12:42:04 a.m. UTC-4 Cameron D wrote:

>
>- as you get closer to the equator, tidal changes dominate the 
>baseline in that timescale - I tried higher order polynomials, but 
> they are 
>next to useless.
>
> I also had little luck with higher order polynomials to remove the 
 general trend.

 I've put the script here: 
 https://github.com/morrowwm/weewx_tonga_browse

>>>

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/b6f1a858-e46f-4cf0-9b43-e09b1c7a3e98n%40googlegroups.com.


Re: [weewx-user] When did the blast wave of the eruption "hit" your station? - extract your data

2022-01-20 Thread storm...@gmail.com
Download the latest script from 
https://github.com/morrowwm/weewx_tonga_browse. Beside installing the 
Python Modules Vince stated above, I needed to also install  python3-scipy. I 
do have data between 1642172400 and 1642693629; except for a couple "null" 
in that time period.   So when I run the script, I get the following error.

raspberrypi:~/Desktop/Tonga $ python3 tonga_barometer.py
distance to eruption 13293.9 km arrival at 1642261629 (2022-01-15 10:47:08)
select datetime, barometer from archive where datetime > 1642172400 and 
datetime < 1642693629 order by dateTime;
Traceback (most recent call last):
  File "tonga_barometer.py", line 47, in 
coeff = np.polyfit(xdata, ydata, 2)
  File "/usr/lib/python3/dist-packages/numpy/lib/polynomial.py", line 590, 
in polyfit
y = NX.asarray(y) + 0.0
TypeError: unsupported operand type(s) for +: 'NoneType' and 'float'

There should be a way to check for "null" data within the time period.
On Thursday, January 20, 2022 at 8:12:55 PM UTC-5 Cameron D wrote:

> yes, definitely looks like there is no data.
> I have attached another version of mine, in which the trend line is 
> disabled by default, but I suspect that would just delay the inevitable and 
> it would crash trying to do the plot.
>
> I also fixed up a few plotting errors in my code to do with the mysteries 
> (to me) of layer ordering.
> I also had a background bar showing either side of expected arrival - in 
> this version I have now changed that to start at the expected arrival and 
> stop 1 hour later.
>
> On Friday, 21 January 2022 at 3:29:36 am UTC+10 bgra...@umw.edu wrote:
>
>> Hello,
>> Not being a programmer, I probably shouldn't have messed with this, but 
>> being curious...
>>
>> I tried the code posted on github as well as the one by Cameron D. In 
>> both cases I got the following error:
>> ```
>> root@n4mrv:/home/bg/weewx_tonga_browse-main# python3 ./tonga.py   [file 
>> from Cameron D]
>>
>> distance to eruption 12056.6 km arrival at 1642258360 (2022-01-15 
>> 09:52:39)
>>   opposite pulse arrival at 1642308921 (2022-01-15 23:55:21)
>>   second time around pulse arrival at 1642385471 (2022-01-16 21:11:10)
>> Traceback (most recent call last):
>>   File "./tonga.py", line 178, in 
>> plot_burst( cursor, arrival_time, hour_span, "primary" )
>>   File "./tonga.py", line 54, in plot_burst
>> coeff = np.polyfit(xdata, ydata, background_order )
>>   File "<__array_function__ internals>", line 180, in polyfit
>>   File "/usr/local/lib/python3.8/dist-packages/numpy/lib/polynomial.py", 
>> line 638, in polyfit
>> raise TypeError("expected non-empty vector for x")
>> TypeError: expected non-empty vector for x
>> ```
>> I added my lat/lon information but may have missed something else I need 
>> to change. Python modules were installed as directed. Copy of weewx.sdb is 
>> in the same directory as the program.
>> Thanks.
>> Bob
>> On Wednesday, January 19, 2022 at 10:32:49 AM UTC-5 morr...@gmail.com 
>> wrote:
>>
>>> On Wednesday, January 19, 2022 at 12:42:04 a.m. UTC-4 Cameron D wrote:
>>>

- as you get closer to the equator, tidal changes dominate the 
baseline in that timescale - I tried higher order polynomials, but they 
 are 
next to useless.

 I also had little luck with higher order polynomials to remove the 
>>> general trend.
>>>
>>> I've put the script here: https://github.com/morrowwm/weewx_tonga_browse
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/21baed8f-5d82-4657-9227-c354eb95169en%40googlegroups.com.


Re: [weewx-user] When did the blast wave of the eruption "hit" your station? - extract your data

2022-01-20 Thread 'Cameron D' via weewx-user
yes, definitely looks like there is no data.
I have attached another version of mine, in which the trend line is 
disabled by default, but I suspect that would just delay the inevitable and 
it would crash trying to do the plot.

I also fixed up a few plotting errors in my code to do with the mysteries 
(to me) of layer ordering.
I also had a background bar showing either side of expected arrival - in 
this version I have now changed that to start at the expected arrival and 
stop 1 hour later.

On Friday, 21 January 2022 at 3:29:36 am UTC+10 bgra...@umw.edu wrote:

> Hello,
> Not being a programmer, I probably shouldn't have messed with this, but 
> being curious...
>
> I tried the code posted on github as well as the one by Cameron D. In both 
> cases I got the following error:
> ```
> root@n4mrv:/home/bg/weewx_tonga_browse-main# python3 ./tonga.py   [file 
> from Cameron D]
>
> distance to eruption 12056.6 km arrival at 1642258360 (2022-01-15 09:52:39)
>   opposite pulse arrival at 1642308921 (2022-01-15 23:55:21)
>   second time around pulse arrival at 1642385471 (2022-01-16 21:11:10)
> Traceback (most recent call last):
>   File "./tonga.py", line 178, in 
> plot_burst( cursor, arrival_time, hour_span, "primary" )
>   File "./tonga.py", line 54, in plot_burst
> coeff = np.polyfit(xdata, ydata, background_order )
>   File "<__array_function__ internals>", line 180, in polyfit
>   File "/usr/local/lib/python3.8/dist-packages/numpy/lib/polynomial.py", 
> line 638, in polyfit
> raise TypeError("expected non-empty vector for x")
> TypeError: expected non-empty vector for x
> ```
> I added my lat/lon information but may have missed something else I need 
> to change. Python modules were installed as directed. Copy of weewx.sdb is 
> in the same directory as the program.
> Thanks.
> Bob
> On Wednesday, January 19, 2022 at 10:32:49 AM UTC-5 morr...@gmail.com 
> wrote:
>
>> On Wednesday, January 19, 2022 at 12:42:04 a.m. UTC-4 Cameron D wrote:
>>
>>>
>>>- as you get closer to the equator, tidal changes dominate the 
>>>baseline in that timescale - I tried higher order polynomials, but they 
>>> are 
>>>next to useless.
>>>
>>> I also had little luck with higher order polynomials to remove the 
>> general trend.
>>
>> I've put the script here: https://github.com/morrowwm/weewx_tonga_browse
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/71655988-a5d6-4771-bb56-12fa455f24f2n%40googlegroups.com.
import time
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
from geopy import distance

#DB="sqlite3"
DB="mysql"
if DB == "sqlite3":
import sqlite3
else:
import sys
import mysql.connector as MysqlConnector
from mysql.connector import errorcode as msqlerrcode
db_user="weewx"
db_pwd="insert-your-password"
db_name="weewx"

# change as needed - (latitude, longitude)
home = (44.8032, -63.6204)


# some barometers only change their reading every nth record in the database
# set oversampling = 1 if the barometer can change every archive record.
# set oversampling = 2 if the barometer updates every 10 minutes but you have a 5 minute sample period
oversampling = 1

# this will remove background if you have a smoothly varying long-term barometer trend
plot_trends=False
# order of polynomial fitted to background
background_order = 2

# you should not need to edit anything below here
# ===

def plot_burst( cursor, pulse_time, span, order ):
start_time = 3600*(pulse_time // 3600 - span)  # start at an even hour
xmax_hours = pulse_time + span*3600 
query = "select datetime, barometer from archive where datetime > %.0f and datetime < %.0f order by dateTime;" %\
( start_time, xmax_hours )
cursor.execute(query)

result = cursor.fetchall()

xdata = []
ydata = []
tdata = []

rowcount = 0
for row in result:
rowcount += 1
if rowcount % oversampling == 0:
xdata.append(row[0])
tdata.append(mdates.datestr2num(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(row[0]
ydata.append(row[1])
   
peakt = [mdates.datestr2num(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime( pulse_time+ 1800 )))]
plotx_range = (
mdates.datestr2num(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime( start_time ))),
mdates.datestr2num(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime( xmax_hours )))
)
bar_width = 1.0/24  # one hour

if plot_trends:
# remove any linear trend
coeff = np.polyfit(xdata, ydata, background_order )
trend = np.polyval(coeff, xdata)

fig, ax = 

Re: [weewx-user] When did the blast wave of the eruption "hit" your station? - extract your data

2022-01-20 Thread morr...@gmail.com
It looks like you retrieved no data. It calculated decent looking arrival 
times, so no problem with the change you made?

Try just a query for data spanning the first arrival. From a shell prompt:

sqlite3 weewx.sdb "select datetime, barometer from archive where datetime > 
1642258360-10 and datetime < 1642258360+10 order by dateTime;"


On Thursday, January 20, 2022 at 1:29:36 p.m. UTC-4 bgra...@umw.edu wrote:

> I tried the code posted on github as well as the one by Cameron D. In both 
> cases I got the following error:
> ```
> root@n4mrv:/home/bg/weewx_tonga_browse-main# python3 ./tonga.py   [file 
> from Cameron D]
>
> distance to eruption 12056.6 km arrival at 1642258360 (2022-01-15 09:52:39)
>   opposite pulse arrival at 1642308921 (2022-01-15 23:55:21)
>   second time around pulse arrival at 1642385471 (2022-01-16 21:11:10)
> Traceback (most recent call last):
>   File "./tonga.py", line 178, in 
> plot_burst( cursor, arrival_time, hour_span, "primary" )
>   File "./tonga.py", line 54, in plot_burst
> coeff = np.polyfit(xdata, ydata, background_order )
>   File "<__array_function__ internals>", line 180, in polyfit
>   File "/usr/local/lib/python3.8/dist-packages/numpy/lib/polynomial.py", 
> line 638, in polyfit
> raise TypeError("expected non-empty vector for x")
> TypeError: expected non-empty vector for x
> ```
> I added my lat/lon information but may have missed something else I need 
> to change. Python modules were installed as directed. Copy of weewx.sdb is 
> in the same directory as the program.
> Thanks.
> Bob
> On Wednesday, January 19, 2022 at 10:32:49 AM UTC-5 morr...@gmail.com 
> wrote:
>
>> On Wednesday, January 19, 2022 at 12:42:04 a.m. UTC-4 Cameron D wrote:
>>
>>>
>>>- as you get closer to the equator, tidal changes dominate the 
>>>baseline in that timescale - I tried higher order polynomials, but they 
>>> are 
>>>next to useless.
>>>
>>> I also had little luck with higher order polynomials to remove the 
>> general trend.
>>
>> I've put the script here: https://github.com/morrowwm/weewx_tonga_browse
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/e3a55dde-1254-495e-9af9-4c71f9ae1e28n%40googlegroups.com.


Re: [weewx-user] When did the blast wave of the eruption "hit" your station? - extract your data

2022-01-20 Thread bgra...@umw.edu
Hello,
Not being a programmer, I probably shouldn't have messed with this, but 
being curious...

I tried the code posted on github as well as the one by Cameron D. In both 
cases I got the following error:
```
root@n4mrv:/home/bg/weewx_tonga_browse-main# python3 ./tonga.py   [file 
from Cameron D]

distance to eruption 12056.6 km arrival at 1642258360 (2022-01-15 09:52:39)
  opposite pulse arrival at 1642308921 (2022-01-15 23:55:21)
  second time around pulse arrival at 1642385471 (2022-01-16 21:11:10)
Traceback (most recent call last):
  File "./tonga.py", line 178, in 
plot_burst( cursor, arrival_time, hour_span, "primary" )
  File "./tonga.py", line 54, in plot_burst
coeff = np.polyfit(xdata, ydata, background_order )
  File "<__array_function__ internals>", line 180, in polyfit
  File "/usr/local/lib/python3.8/dist-packages/numpy/lib/polynomial.py", 
line 638, in polyfit
raise TypeError("expected non-empty vector for x")
TypeError: expected non-empty vector for x
```
I added my lat/lon information but may have missed something else I need to 
change. Python modules were installed as directed. Copy of weewx.sdb is in 
the same directory as the program.
Thanks.
Bob
On Wednesday, January 19, 2022 at 10:32:49 AM UTC-5 morr...@gmail.com wrote:

> On Wednesday, January 19, 2022 at 12:42:04 a.m. UTC-4 Cameron D wrote:
>
>>
>>- as you get closer to the equator, tidal changes dominate the 
>>baseline in that timescale - I tried higher order polynomials, but they 
>> are 
>>next to useless.
>>
>> I also had little luck with higher order polynomials to remove the 
> general trend.
>
> I've put the script here: https://github.com/morrowwm/weewx_tonga_browse
>

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/c1e685f8-af86-4839-9faf-bd2ad5e14ee5n%40googlegroups.com.


Re: [weewx-user] When did the blast wave of the eruption "hit" your station? - extract your data

2022-01-19 Thread morr...@gmail.com
On Wednesday, January 19, 2022 at 12:42:04 a.m. UTC-4 Cameron D wrote:

>
>- as you get closer to the equator, tidal changes dominate the 
>baseline in that timescale - I tried higher order polynomials, but they 
> are 
>next to useless.
>
> I also had little luck with higher order polynomials to remove the general 
trend.

I've put the script here: https://github.com/morrowwm/weewx_tonga_browse

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/4f1993c1-e300-47d4-9ebc-cb2a43128d0bn%40googlegroups.com.


Re: [weewx-user] When did the blast wave of the eruption "hit" your station? - extract your data

2022-01-18 Thread 'Cameron D' via weewx-user
Thanks for that obsession. I was wondering how to start learning about 
plotting in python.  I've not got very far.
What I have done in the attached version is:

   - add option towork with mysql db
   - plot first 3 pulse times.
   - added a background grey bar for 3 min either side of hte expected time.
   - also a wide-scale plot covering them all.
   - as you get closer to the equator, tidal changes dominate the baseline 
   in that timescale - I tried higher order polynomials, but they are next to 
   useless.

This version generates 4 png files.[image: Hunga_Tonga_return.png]
I was even able to see a small dip at the expected time it was making its 
second pass around (as seen in the image). The dip far left is the opposite 
direction pulse.
On Wednesday, 19 January 2022 at 3:40:46 am UTC+10 morr...@gmail.com wrote:

> I may be starting to obsess a bit, but give the attached python script a 
> try. You may have to install additional modules, e.g. geopy and sqlite3.
>
> 1. On line 9, specify your location
> 2. On line 14, specify the range of hours you want to examine, around the 
> event.
> 3. On line 25, you may need to adjust the query if your pressure data is 
> not in the barometer column of the archive table
> 3. Move to the directory containing your weewx.sdb database, or on line 
> 22, specify its full path.
> 4. Run the script
>
> The script calculates the distance from the eruption to your location, the 
> travel time to your location at the speed of sound, and then queries and 
> plots, and saves the barometer data for a time range around the estimated 
> arrival time. It also remove any linear trend and plots the difference from 
> that linear trend. 
>
> Follow up with any improvements!
>
> Mine looks like this:
> [image: hunga_tonga.png]
>

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/a6ffa761-afcb-4d12-be4d-776a91d2788fn%40googlegroups.com.
import time
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
from geopy import distance

#DB="sqlite3"
DB="mysql"
if DB == "sqlite3":
import sqlite3
else:
import sys
import mysql.connector
from mysql.connector import errorcode as msqlerrcode
db_user="weewx"
db_pwd="insert-your-password"
db_name="weewx"

# change as needed
home = (44.8032, -63.62038)

# some barometers only change their reading every nth record in the database
# set oversampling = 1 if the barometer can change every archive record.
# set oversampling = 2 if the barometer updates every 10 minutes but you have a 5 minute sample period
oversampling = 1

# order of polynomial fitted to background
background_order = 2

# you should not need to edit anything below here
# ===

def plot_burst( cursor, pulse_time, span, order ):
query = "select datetime, barometer from archive where datetime > %.0f and datetime < %.0f order by dateTime;" %\
( pulse_time - span*3600, pulse_time + span*3600)
cursor.execute(query)

result = cursor.fetchall()

xdata = []
ydata = []
tdata = []

rowcount = 0
for row in result:
rowcount += 1
if rowcount % oversampling == 0:
xdata.append(row[0])
tdata.append(mdates.datestr2num(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(row[0]
ydata.append(row[1])
   
peakt = [mdates.datestr2num(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime( pulse_time )))]
# remove any linear trend
coeff = np.polyfit(xdata, ydata, background_order )
trend = np.polyval(coeff, xdata)

fig, ax = plt.subplots()

date_formatter = mdates.DateFormatter('%m-%d %H:%M')
ax.tick_params(axis="x", rotation=90)
ax.xaxis.set_major_formatter(date_formatter)

fig.subplots_adjust(bottom=0.2)

ax2 = ax.twinx()
ax2.set_axis_off()
ax2.bar( peakt, [1] , width=0.25/span, color="lightgrey" )  

ax.plot(tdata, ydata, color="paleturquoise", linewidth=3)

ax2=ax.twinx()
ax2.plot(tdata, ydata - trend, marker="+", linewidth=1)

#plt.show()
# save the plot as a file
filename = "./Hunga_Tonga_" + order + ".png"
fig.savefig( filename, format='png', dpi=100, bbox_inches='tight')

#plt.show()


def plot_all( cursor, e_time, pulse_time1, pulse_time2, pulse_time3, span ):
query = "select datetime, barometer from archive where datetime > %.0f and datetime < %.0f order by dateTime;" %\
( e_time - span*3600, pulse_time3 + span*3600)
cursor.execute(query)

result = cursor.fetchall()

xdata = []
ydata = []
tdata = []

rowcount = 0
for row in result:
rowcount += 1
if rowcount % oversampling == 0:

Re: [weewx-user] When did the blast wave of the eruption "hit" your station? - extract your data

2022-01-18 Thread morr...@gmail.com
On Tuesday, January 18, 2022 at 5:15:49 p.m. UTC-4 vince wrote:

> Very cool - I had to spin up a gnome desktop lightsail instance and VNC in 
> from my Mac mini but I got there.  Is there a way to run this one headless 
> to generate the image for viewing on a different computer ?


Easiest is just to comment out the "plt.show()"  at the end. I've attached 
a version which does that, and pretties up the output a bit.


> FWIW - on ubuntu you need to: "sudo apt-get install python3-matplotlib 
> python3-numpy python3-geopy" for the requisite pieces of the puzzle.
>
> My data => distance 9195.8 km arrival at 1642248822 (2022-01-15 04:13:41) 
> here about 3 km from the water between Seattle+Tacoma
>

It looks like your pressure was fairly flat. Maybe expand the time range, 
so that's obvious?
 

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/a6ebe634-6940-4fd4-aa6e-71d122fbe9fbn%40googlegroups.com.
import time
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
import sqlite3
from geopy import distance

# change as needed
home = (44.80321621050904, -63.62038361172844)

hunga_tonga = (-20.5452074472518, -175.38715105641674)
speed_of_sound = 0.32 # km/s
eruption_time = 1642220085 # 2022-01-15 04:14:45 UTC
hour_lead = 6
hour_lag = 6

distance = distance.distance(hunga_tonga, home).km
travel_time = distance / speed_of_sound
arrival_time = eruption_time + travel_time
start_time = 3600*(arrival_time // 3600 - hour_lead)  # start at an even hour

print("distance to eruption %0.1f km arrival at %.0f (%s)" % (distance, arrival_time, time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(arrival_time
  
connection = sqlite3.connect('weewx.sdb')
cursor = connection.cursor()

query = "select datetime, barometer from archive where datetime > %.0f and datetime < %.0f order by dateTime;" % (start_time, arrival_time + hour_lag*3600)
print(query)
cursor.execute(query).fetchall

result = cursor.fetchall()

connection.close()

xdata = []
ydata = []
tdata = []

for row in result:
   xdata.append(row[0])
   tdata.append(mdates.datestr2num(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(row[0]
   ydata.append(row[1])
   
# remove any linear trend
coeff = np.polyfit(xdata, ydata, 2)
trend = np.polyval(coeff, xdata)

fig, ax = plt.subplots()

plt.text(tdata[1], np.max(ydata), "location: %0.2f, %0.2f" % home)

date_formatter = mdates.DateFormatter('%m-%d %H:%M')
ax.tick_params(axis="x", rotation=90)
ax.xaxis.set_major_locator(mdates.HourLocator(interval = 1))
ax.xaxis.set_major_formatter(date_formatter)
ax.xaxis.set_minor_locator(mdates.MinuteLocator(interval = 10))
#ax.set_xlim(xmin=tdata[0]//1) # start at a round hour

fig.subplots_adjust(bottom=0.2)

ax.plot(tdata, ydata, color="paleturquoise", linewidth=3)
ax.plot(tdata, trend, color="lightgrey", linewidth=1)

ax2=ax.twinx()
ax2.plot(tdata, ydata - trend, linewidth=1)

# save the plot as a file
fig.savefig('./hunga_tonga.png', format='png', dpi=100, bbox_inches='tight')

#plt.show()


Re: [weewx-user] When did the blast wave of the eruption "hit" your station? - extract your data

2022-01-18 Thread michael.k...@gmx.at
If I had to guess, the script detects the wave front, not the peak.

kk44...@gmail.com schrieb am Dienstag, 18. Januar 2022 um 20:45:22 UTC+1:

> What I realized: The arrival time is not quite accurate in my case. The 
> script says 19:35, but the records show the peak at 20:25. 
>
> michael.k...@gmx.at schrieb am Dienstag, 18. Januar 2022 um 20:39:22 
> UTC+1:
>
>> An improvement could be to also extract data for the 2nd wave from the 
>> other direction.
>>
>> michael.k...@gmx.at schrieb am Dienstag, 18. Januar 2022 um 20:35:59 
>> UTC+1:
>>
>>> Obsessed? You're just wrong in the right way :D ;)
>>>
>>> I really like this thread, and your script. Here is my result:
>>>
>>> distance to eruption 16894.9 km arrival at 1642272882 (2022-01-15 
>>> 19:54:41)
>>>
>>> Google Earth Pro tells me, the distance is 16880.6km. 
>>>
>>> [image: hunga_tonga.png]
>>> morr...@gmail.com schrieb am Dienstag, 18. Januar 2022 um 18:40:46 
>>> UTC+1:
>>>
 I may be starting to obsess a bit, but give the attached python script 
 a try. You may have to install additional modules, e.g. geopy and sqlite3.

 1. On line 9, specify your location
 2. On line 14, specify the range of hours you want to examine, around 
 the event.
 3. On line 25, you may need to adjust the query if your pressure data 
 is not in the barometer column of the archive table
 3. Move to the directory containing your weewx.sdb database, or on line 
 22, specify its full path.
 4. Run the script

 The script calculates the distance from the eruption to your location, 
 the travel time to your location at the speed of sound, and then queries 
 and plots, and saves the barometer data for a time range around the 
 estimated arrival time. It also remove any linear trend and plots the 
 difference from that linear trend. 

 Follow up with any improvements!

 Mine looks like this:
 [image: hunga_tonga.png]

>>>

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/284525c6-2e1e-4d8d-83aa-9cd928383accn%40googlegroups.com.


Re: [weewx-user] When did the blast wave of the eruption "hit" your station? - extract your data

2022-01-18 Thread Karen K
What I realized: The arrival time is not quite accurate in my case. The 
script says 19:35, but the records show the peak at 20:25. 

michael.k...@gmx.at schrieb am Dienstag, 18. Januar 2022 um 20:39:22 UTC+1:

> An improvement could be to also extract data for the 2nd wave from the 
> other direction.
>
> michael.k...@gmx.at schrieb am Dienstag, 18. Januar 2022 um 20:35:59 
> UTC+1:
>
>> Obsessed? You're just wrong in the right way :D ;)
>>
>> I really like this thread, and your script. Here is my result:
>>
>> distance to eruption 16894.9 km arrival at 1642272882 (2022-01-15 
>> 19:54:41)
>>
>> Google Earth Pro tells me, the distance is 16880.6km. 
>>
>> [image: hunga_tonga.png]
>> morr...@gmail.com schrieb am Dienstag, 18. Januar 2022 um 18:40:46 UTC+1:
>>
>>> I may be starting to obsess a bit, but give the attached python script a 
>>> try. You may have to install additional modules, e.g. geopy and sqlite3.
>>>
>>> 1. On line 9, specify your location
>>> 2. On line 14, specify the range of hours you want to examine, around 
>>> the event.
>>> 3. On line 25, you may need to adjust the query if your pressure data is 
>>> not in the barometer column of the archive table
>>> 3. Move to the directory containing your weewx.sdb database, or on line 
>>> 22, specify its full path.
>>> 4. Run the script
>>>
>>> The script calculates the distance from the eruption to your location, 
>>> the travel time to your location at the speed of sound, and then queries 
>>> and plots, and saves the barometer data for a time range around the 
>>> estimated arrival time. It also remove any linear trend and plots the 
>>> difference from that linear trend. 
>>>
>>> Follow up with any improvements!
>>>
>>> Mine looks like this:
>>> [image: hunga_tonga.png]
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/0b623a6f-4b4b-4016-a861-860c4e0bbc5cn%40googlegroups.com.


Re: [weewx-user] When did the blast wave of the eruption "hit" your station? - extract your data

2022-01-18 Thread michael.k...@gmx.at
An improvement could be to also extract data for the 2nd wave from the 
other direction.

michael.k...@gmx.at schrieb am Dienstag, 18. Januar 2022 um 20:35:59 UTC+1:

> Obsessed? You're just wrong in the right way :D ;)
>
> I really like this thread, and your script. Here is my result:
>
> distance to eruption 16894.9 km arrival at 1642272882 (2022-01-15 19:54:41)
>
> Google Earth Pro tells me, the distance is 16880.6km. 
>
> [image: hunga_tonga.png]
> morr...@gmail.com schrieb am Dienstag, 18. Januar 2022 um 18:40:46 UTC+1:
>
>> I may be starting to obsess a bit, but give the attached python script a 
>> try. You may have to install additional modules, e.g. geopy and sqlite3.
>>
>> 1. On line 9, specify your location
>> 2. On line 14, specify the range of hours you want to examine, around the 
>> event.
>> 3. On line 25, you may need to adjust the query if your pressure data is 
>> not in the barometer column of the archive table
>> 3. Move to the directory containing your weewx.sdb database, or on line 
>> 22, specify its full path.
>> 4. Run the script
>>
>> The script calculates the distance from the eruption to your location, 
>> the travel time to your location at the speed of sound, and then queries 
>> and plots, and saves the barometer data for a time range around the 
>> estimated arrival time. It also remove any linear trend and plots the 
>> difference from that linear trend. 
>>
>> Follow up with any improvements!
>>
>> Mine looks like this:
>> [image: hunga_tonga.png]
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/d221ba1a-8760-4ff8-b92e-c09ae8406760n%40googlegroups.com.


Re: [weewx-user] When did the blast wave of the eruption "hit" your station? - extract your data

2022-01-18 Thread michael.k...@gmx.at
Obsessed? You're just wrong in the right way :D ;)

I really like this thread, and your script. Here is my result:

distance to eruption 16894.9 km arrival at 1642272882 (2022-01-15 19:54:41)

Google Earth Pro tells me, the distance is 16880.6km. 

[image: hunga_tonga.png]
morr...@gmail.com schrieb am Dienstag, 18. Januar 2022 um 18:40:46 UTC+1:

> I may be starting to obsess a bit, but give the attached python script a 
> try. You may have to install additional modules, e.g. geopy and sqlite3.
>
> 1. On line 9, specify your location
> 2. On line 14, specify the range of hours you want to examine, around the 
> event.
> 3. On line 25, you may need to adjust the query if your pressure data is 
> not in the barometer column of the archive table
> 3. Move to the directory containing your weewx.sdb database, or on line 
> 22, specify its full path.
> 4. Run the script
>
> The script calculates the distance from the eruption to your location, the 
> travel time to your location at the speed of sound, and then queries and 
> plots, and saves the barometer data for a time range around the estimated 
> arrival time. It also remove any linear trend and plots the difference from 
> that linear trend. 
>
> Follow up with any improvements!
>
> Mine looks like this:
> [image: hunga_tonga.png]
>

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/8af547b8-fa96-43d3-a0cd-84f123707862n%40googlegroups.com.


Re: [weewx-user] When did the blast wave of the eruption "hit" your station? - extract your data

2022-01-18 Thread morr...@gmail.com
I may be starting to obsess a bit, but give the attached python script a 
try. You may have to install additional modules, e.g. geopy and sqlite3.

1. On line 9, specify your location
2. On line 14, specify the range of hours you want to examine, around the 
event.
3. On line 25, you may need to adjust the query if your pressure data is 
not in the barometer column of the archive table
3. Move to the directory containing your weewx.sdb database, or on line 22, 
specify its full path.
4. Run the script

The script calculates the distance from the eruption to your location, the 
travel time to your location at the speed of sound, and then queries and 
plots, and saves the barometer data for a time range around the estimated 
arrival time. It also remove any linear trend and plots the difference from 
that linear trend. 

Follow up with any improvements!

Mine looks like this:
[image: hunga_tonga.png]

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/a387d05e-39d0-4586-b979-2ee027c9b951n%40googlegroups.com.
import time
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
import sqlite3
from geopy import distance

# change as needed
home = (44.80321621050904, -63.62038361172844)

hunga_tonga = (-20.5452074472518, -175.38715105641674)
speed_of_sound = 0.32 # km/s
eruption_time = 1642220085 # 2022-01-15 04:14:45 UTC
hour_span = 6

distance = distance.distance(hunga_tonga, home).km
travel_time = distance / speed_of_sound
arrival_time = eruption_time + travel_time

print("distance to eruption %0.1f km arrival at %.0f (%s)" % (distance, arrival_time, time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(arrival_time
  
connection = sqlite3.connect('weewx.sdb')
cursor = connection.cursor()

query = "select datetime, barometer from archive where datetime > %.0f and datetime < %.0f order by dateTime;" % (arrival_time - hour_span*3600, arrival_time + hour_span*3600)
cursor.execute(query).fetchall

result = cursor.fetchall()

connection.close()

xdata = []
ydata = []
tdata = []

for row in result:
   xdata.append(row[0])
   tdata.append(mdates.datestr2num(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(row[0]
   ydata.append(row[1])
   
# remove any linear trend
coeff = np.polyfit(xdata, ydata, 1)
trend = np.polyval(coeff, xdata)

fig, ax = plt.subplots()

date_formatter = mdates.DateFormatter('%m-%d %H:%M')
ax.tick_params(axis="x", rotation=90)
ax.xaxis.set_major_formatter(date_formatter)

fig.subplots_adjust(bottom=0.2)

ax.plot(tdata, ydata, color="paleturquoise", linewidth=3)

ax2=ax.twinx()
ax2.plot(tdata, ydata - trend, marker="+", linewidth=1)

plt.show()
# save the plot as a file
fig.savefig('./hunga_tonga.png', format='png', dpi=100, bbox_inches='tight')

plt.show()