Author Topic: Intro and Lowest High question  (Read 11288 times)

vetenskapsman

  • Gentle Breeze
  • **
  • Posts: 10
    • KNMCORRA6
  • Station Details: Davis Vantage Pro2+, iMac (21.5-inch, Mid 2011), OS Sierra 10.12.1
Intro and Lowest High question
« on: November 09, 2016, 04:44:19 PM »
Hello all,   I keep seeing my id, ventenskapsman, on the Welcome our Newest Member tag at the top of the forum index and felt bad I haven't introduced myself.  As I finally have questions I thought I'd do just that!

I've been using WC since I first acquired a Davis Vantage Pro as a (very nice) Christmas present in 2012.  I've happily been using the station and WC all these years which covered about 2.5 years in San Jose, CA and now 2.5 years in Corrales, NM (just outside Albuquerque).  Other than reporting to Wunderground, ID=KNMCORRA6, I haven't had much time to look into creating a personal weather page. 

I recently upgraded to V2.4 and have navigated OS Sierra issues thanks to many forum posters (all I had to do was turn off the sleep setting and that solved the hangs).  I also see we have synthetic channels now (very cool) and a more feature rich tag set than was available in 2012!  If you don't upgrade for a while you miss out on a lot  :-[ .  I'm now considering putting my toe in the waters of making a personal web page and since I don't have any previous experience with this I am starting slow and simple by playing the venerable atkins template and saving to local disk for learning and testing.

On to my question ... With a synthetic channel I can finally make a data channel to report the daily temperature range (Highest Temp - Lowest Temp) which is something I've wanted to do for a long time.  What I'd also like to be able to report is the Lowest High Temperature over a period (e.g. Monthly) as well as the Highest Low Temperature over a period.

I've looked through the forums and the Weather Cat tags reference and can't figure a way to do it.   I've come to the conclusion that either 1.) It can't be (easily) done or 2.) The answer is so simple I'll be embarrassed once you point it out to me.

Not quite sure why I find temperature range and coolest days and warmest nights so interesting but I certainly do!  Thanks for any insight you can give and I certainly will be posting more novice questions as I journey down the path to making a personal weather page.

best,  -carl


wurzelmac

  • Storm
  • *****
  • Posts: 1457
    • ITIROLPR2
    • Wetterstation Prägraten am Großvenediger
  • Station Details: Davis Vantage PRO2 Plus (24h fan aspirated, wireless) with UV/Solar | Weather Envoy Data Logger | Mac mini 2023 M2 8/256 | 1x Canon EOS 1100D | macOS Sonoma 15.0.1 | WC v330b300
Re: Intro and Lowest High question
« Reply #1 on: November 09, 2016, 05:56:13 PM »
Hi Carl - warm welcome!

In here you surely will find someone that can help you out with your (very specific) task. For me I am not sure if this is possible, lets wait for the brave *synthetic channelours*  and their input.  :)
Reinhard


Blicj11

  • Storm
  • *****
  • Posts: 4078
    • EW3808
    • KUTHEBER6
    • Timber Lakes Weather
  • Station Details: Davis Vantage Pro2 Plus | WeatherLinkIP Data Logger | iMac (2019), 3.6 GHz Intel Core i9, 40 GB RAM, macOS Sonoma 14.8.5 | WeatherCat 3.3.3 | Supportive Wife
Re: Intro and Lowest High question
« Reply #2 on: November 09, 2016, 07:43:21 PM »
Welcome to the forum Carl. Edouard is our resident custom channel expert. If it can be done, he will know how to do it.
Blick


vetenskapsman

  • Gentle Breeze
  • **
  • Posts: 10
    • KNMCORRA6
  • Station Details: Davis Vantage Pro2+, iMac (21.5-inch, Mid 2011), OS Sierra 10.12.1
Re: Intro and Lowest High question
« Reply #3 on: November 09, 2016, 08:41:34 PM »
Thank you Reinhard and Blick!  Appreciate the welcomes very much.

If I understand synthetic channels correctly I don't think it can be done as those channels deal with the manipulation of incoming data in one of four ways, Current Value, Daily High, Low and Average.

To solve my problem of finding the coolest day or warmest night I think it is more of a "query" the data log issue which can be done in a number of interesting ways with Tags, such as, find the Highest Temp in the last Month, Year or even time period.  But I couldn't see any way to do a similar thing to find the Lowest High Temp (basically the coolest Day, or similarly, the warmest night, over a given time period (Week, Month, Year etc).

best,  -carl


elagache

  • Global Moderator
  • Storm
  • *****
  • Posts: 6686
    • DW3835
    • KCAORIND10
    • Canebas Weather
  • Station Details: Davis Vantage Pro-2, Mac mini (2018), macOS 10.14.3, WeatherCat 3
Welcome. (Re: Lowest High question)
« Reply #4 on: November 09, 2016, 10:30:37 PM »
Dear Carl, Reinhard, Blick, and WeatherCat welcome wagon, . . .

First things first, Welcome to the WeatherCat forum!

On to my question ... With a synthetic channel I can finally make a data channel to report the daily temperature range (Highest Temp - Lowest Temp) which is something I've wanted to do for a long time. 

Edouard is our resident custom channel expert. If it can be done, he will know how to do it.

 ;) . . . . *Sigh*, how did I get myself volunteered into this one! . . . .  lol(1)

Okay it isn't difficult to create a synthetic channel that will report in real time what is the daily temperature range.  The actual AppleScript is just one line:

Code: [Select]
return(Param1 - Param2)
Honestly, you could just have the subtraction of the two parameters, but I use the return to make it a little more clear what is going on.  You then would need to set up the synthetic channel like this:



The only problem with this scheme is that it would return values through the day and would not give you the final value you want until after the high temperature has been reached.  After the high temperature is reached the value would be correct until midnight when it would reset once more.  However, I don't think you could do better than that.

What I'd also like to be able to report is the Lowest High Temperature over a period (e.g. Monthly) as well as the Highest Low Temperature over a period.

This would be extremely difficult and risky do to as a synthetic channel.  However, I thought the WeatherCat STAT$ tag could do this sort of thing.  Anybody know?  I'm not particularly good with that tag.

Once more welcome!

Cheers, Edouard  [cheers1]

P.S. I hope the title of the synthetic channel doesn't confuse anyone.  I "hijacked" one of my existing channels temporarily to show what changes were needed.

xairbusdriver

  • Storm
  • *****
  • Posts: 3131
Re: Intro and Lowest High question
« Reply #5 on: November 09, 2016, 11:46:58 PM »
Quote
After the high temperature is reached the value would be correct until midnight when it would reset once more.  However, I don't think you could do better than that.
If you can gather the data, then you can create a small script to write it to a database. Then the DB can be queried as needed for the statistics. Perhaps AS/Automator can handle doing the DB parts, even if it's just using Numbers (still comes with every Mac, AFAIK) and creating a flat "database".
THERE ARE TWO TYPES OF COUNTRIES
Those that use metric = #1 Measurement system
And the United States = The Banana system

vetenskapsman

  • Gentle Breeze
  • **
  • Posts: 10
    • KNMCORRA6
  • Station Details: Davis Vantage Pro2+, iMac (21.5-inch, Mid 2011), OS Sierra 10.12.1
Re: Intro and Lowest High question
« Reply #6 on: November 10, 2016, 05:58:44 PM »
Thanks Edouard!  And appreciate the Welcome Wagon  [cheers1]

Yes, finding the lowest high temperature (or warmest low temperature) during the month, or year etc seems to be a job for the $STAT tag but I couldn't figure it out and that is where I am stuck.  If anyone has a solution I'd love to know.

I was able to figure out the simple solution to the daily temperature Range as you describe.  And you are correct it will have a daily reset at midnight but that is OK and also that the correct value isn't reached until the high temperature is reached for the day but that is what I want.  Mostly I am interested in the Max/Min temp range for a given month or year and now that I have a synthetic channel generating the data I can easily get it.

xairbusdriver,  what you describe would certainly do the job but unfortunately is well beyond my ability.  The values I seek (highest low, lowest high) are sitting right there in the Monthly Reports that are generated but I don't think I can get at it (easily) unless the $STAT tag has the ability.

-carl

wurzelmac

  • Storm
  • *****
  • Posts: 1457
    • ITIROLPR2
    • Wetterstation Prägraten am Großvenediger
  • Station Details: Davis Vantage PRO2 Plus (24h fan aspirated, wireless) with UV/Solar | Weather Envoy Data Logger | Mac mini 2023 M2 8/256 | 1x Canon EOS 1100D | macOS Sonoma 15.0.1 | WC v330b300
Re: Intro and Lowest High question
« Reply #7 on: November 10, 2016, 06:31:57 PM »
Hi carl,

here is simply all that is possible with tags: http://live.trixology.com/custom/
Scroll down to the section shown in the attached screenshot - maybe the solution is hidden in there.

Good luck,
Reinhard


elagache

  • Global Moderator
  • Storm
  • *****
  • Posts: 6686
    • DW3835
    • KCAORIND10
    • Canebas Weather
  • Station Details: Davis Vantage Pro-2, Mac mini (2018), macOS 10.14.3, WeatherCat 3
Try these STAT$ queries. (Re: Lowest High question)
« Reply #8 on: November 11, 2016, 12:19:43 AM »
Dear Carl, Reinhard, and WeatherCat troubleshooters,

Thanks Edouard!  And appreciate the Welcome Wagon  [cheers1]

Well, you see I have this certain - thing - about wagons.   In particular a certain adventurous 1965 Buick Special wagon . . . . .



Yes, finding the lowest high temperature (or warmest low temperature) during the month, or year etc seems to be a job for the $STAT tag but I couldn't figure it out and that is where I am stuck. 

Okay, since nobody else could figure this out.  I gave it another look and it seems to me that this works.  This will give you the hottest temperature this month:

Code: [Select]
STAT$TEMPERATURE:MAX:THISMONTH$
The coldest is just a small change:

Code: [Select]
STAT$TEMPERATURE:MIN:THISMONTH$
You can use AppleScript to test a STAT$ query.  Here is a small AppleScript that returns the max for the month:

Code: [Select]
set highTemp to ""

tell application "WeatherCat"
set Query to "STAT$TEMPERATURE:MAX:THISMONTH$"
set highTemp to QueryResult
end tell

"Hottest temperature this month was: " & highTemp

Here is the corresponding coldest temperature this month AppleScript:

Code: [Select]
set lowTemp to ""

tell application "WeatherCat"
set Query to "STAT$TEMPERATURE:MIN:THISMONTH$"
set lowTemp to QueryResult
end tell

"Coldest temperature this month was: " & lowTemp

You could cut and paste these examples into the AppleScript editor and give them a try.  It is easier to use AppleScript to make sure that your STAT$ query is correct than to put it into a webpage and have it fail without any understanding of why.

I hope that gets you going in the right direction!  [tup]

Cheers, Edouard  [cheers1]

xairbusdriver

  • Storm
  • *****
  • Posts: 3131
Re: Intro and Lowest High question
« Reply #9 on: November 11, 2016, 03:09:56 AM »
Quote
What I'd also like to be able to report is the Lowest High Temperature over a period (e.g. Monthly) as well as the Highest Low Temperature over a period.
I would have sworn that what he he wanted was the lowest high and the highest low. Not the hi set high nor the lowest low. And for each week, month, year, decade, century, ... OK, maybe not the century, he probably doesn't have that much data...

The "query" then, would only need to look at the week's/month's/etc highs and lows and then sort numerically. The lowest high is at the bottom, the highest low is at the top.

I assume your AS could run in a loop and create a list (database) for each year/month/week from the data already in WC?

Of course, he may have something completely different in mind ... Monty Python's Flying Circus?
THERE ARE TWO TYPES OF COUNTRIES
Those that use metric = #1 Measurement system
And the United States = The Banana system

vetenskapsman

  • Gentle Breeze
  • **
  • Posts: 10
    • KNMCORRA6
  • Station Details: Davis Vantage Pro2+, iMac (21.5-inch, Mid 2011), OS Sierra 10.12.1
Re: Intro and Lowest High question
« Reply #10 on: November 11, 2016, 04:00:29 AM »
xairbusdriver, you swear correctly :)  And I fear I have created a circus of confusion with my query (pun intended).  You have it exactly correct.  I'd like to find, and report in a web page the coolest (high) temperature over a given period (say monthly) and also the warmest low temperature over a period (say monthly).

And your description of the method is also correct - I just don't know how to do that.  I was hoping to do this with tags but I am beginning to see that isn't possible with the current set and that if I really want to do this I'll have to dig into AppleScript more to learn how to do that.

Edouard, I really appreciate the time you took to look into this.  I did learn one really neat thing - you can put tags in the AppleScript editor.  Very neat.  That will save me a lot of time testing while I learn the ropes.  Oh and your real life wagon?  Your coolness factor just went up 100 fold  8).

best,  -carl

xairbusdriver

  • Storm
  • *****
  • Posts: 3131
Re: Intro and Lowest High question
« Reply #11 on: November 11, 2016, 09:13:22 PM »
I think I've found what your need, Carl! <R> It's made exactly handling data/statistics! And it's open-source! ThU5:-)
THERE ARE TWO TYPES OF COUNTRIES
Those that use metric = #1 Measurement system
And the United States = The Banana system

Steve

  • Global Moderator
  • Storm
  • *****
  • Posts: 1592
    • DW8454
    • KOHAVON11
    • Avon Weather
  • Station Details: Davis Wireless VP2 Plus w/24 hr FARS, 2023 Mac mini M2 Pro, 32GB RAM, Mac OS 15, WeatherCat 3.3
Re: Intro and Lowest High question
« Reply #12 on: November 11, 2016, 09:47:05 PM »
I think I've found what your need, Carl! <R>

That's what pirates use when programming...












Thank you very much. I'll be here all week.
Steve - Avon, Ohio, USA


CWOP: DW8454 - WU: KOHAVON11 - AWEKAS
PWSweather - WeatherCloud - Facebook

xairbusdriver

  • Storm
  • *****
  • Posts: 3131
Re: Intro and Lowest High question
« Reply #13 on: November 11, 2016, 10:02:01 PM »
Steve +1 But don't quit your day job!
THERE ARE TWO TYPES OF COUNTRIES
Those that use metric = #1 Measurement system
And the United States = The Banana system

elagache

  • Global Moderator
  • Storm
  • *****
  • Posts: 6686
    • DW3835
    • KCAORIND10
    • Canebas Weather
  • Station Details: Davis Vantage Pro-2, Mac mini (2018), macOS 10.14.3, WeatherCat 3
Yup, not so easy. (Re: Intro and Lowest High question)
« Reply #14 on: November 12, 2016, 12:07:23 AM »
Dear Carl and WeatherCat tinkerers,

xairbusdriver, you swear correctly :)  And I fear I have created a circus of confusion with my query (pun intended).  You have it exactly correct.  I'd like to find, and report in a web page the coolest (high) temperature over a given period (say monthly) and also the warmest low temperature over a period (say monthly).

Okay my misunderstanding.  Unfortunately as others have pointed out.  This won't be very easy to do.  WeatherCat can export data to an SQL database.  Perhaps that is your best bet.

Edouard, I really appreciate the time you took to look into this.  I did learn one really neat thing - you can put tags in the AppleScript editor.  Very neat.  That will save me a lot of time testing while I learn the ropes.  Oh and your real life wagon?  Your coolness factor just went up 100 fold  8).

Well my trusty wagon continues to be adventurous . . . . This morning she was a little - too - adventurous!   However, for those of us as old as I am, you'll just have to wait for the "11 O'Clock news" for those details! . . . .  ;D

Cheers, Edouard  [cheers1]