New: provide clouds from METAR station in the night

Personnal Weather Station (PWS) support
Post Reply
User avatar
par
Posts: 8629
Joined: Mon Sep 21, 2009 11:56 am
Name: Pasha
Location: Saint-Petersburg, Russia
Contact:

New: provide clouds from METAR station in the night

Post by par »

We have a new feature in YoWindow XML format asked by Holli and Andreas here.
http://yowindow.com/forum/viewtopic.php ... 517&p=1717

There is a problem - most PWSs cannot read cloud coverage in the night.
A nice solution is to read cloud coverage from the closest METAR station when it's dark.
So you have reliable cloud coverage detection in the day and pretty decent in the night.

In order to control this behavior a new 'include' attribute of clouds tag introduced.

If you want YoWindow to read cloud coverage from PWS in the daylight and from METAR in the night,
add include attribute with "daylight" value to the clouds tag.

Example:
<clouds value="fair" include="daylight">
</clouds>

By "daylight" I mean the time of the day when the sun is over horizon.
Holli, Andreas, do you agree with my definition of the daylight?
Does Ws-win detects dunkel in the same way?

Jim and Rainer, 'include' attribute is also supported in <icon> node of Weather Display format.
The meaning is the same, if 'include' is set to 'daylight', the sky conditions and description are read from METAR station.
So you may use it now in template and PHP script.

The feature is available in RC build so far.

Comments, suggestions, critics are welcome!
Get YoWindow weather app for your phone or tablet.

Image Image Image
gemini06720

Re: New: provide clouds from METAR station in the night

Post by gemini06720 »

Pasha, I just read about your addition of the cloud cover for nights...

Just to make sure I understand correctly the modifications, if I use the following:

Code: Select all

<clouds value="partlyCloudy"/>
that means that my station is providing the cloud information 24/7, whereas if I use the following:

Code: Select all

<clouds value="partlyCloudy" include="daylight">
that means that my station is ONLY providing the cloud information during daylight hours (the sun is over the horizon).

May I recommend, for completeness, that YoWindows also recognize the word 'always' rather than just 'daylight' so the following line of code can be placed and left in the XML file:

Code: Select all

<clouds value="partlyCloudy" include="always">
The above line would obviously mean that the station is providing the cloud information 24/7...

A couple of questions:

- In your message you used the closing tag '</cloud>' - is it needed?
- When are closing tags needed?
- Can closing tags be used for all opening tags, such as '<pressure value="1015.0" unit="hPa"/></pressure>'?

FInally, is there a possibility that Rainer's 'cloud-base' PHP script could be adapted/used by PWS where cloud information is not available during the night period?
Holli

Re: New: provide clouds from METAR station in the night

Post by Holli »

gemini06720 wrote: A couple of questions:

- In your message you used the closing tag '</cloud>' - is it needed?
- When are closing tags needed?
- Can closing tags be used for all opening tags, such as '<pressure value="1015.0" unit="hPa"/></pressure>'?
It's simple XML syntax convention: All tags must be closed. Tags without content may be closed by itself, tags with content by a closing tag.

The clouds tag can contain the icon tag, so it's not empty and cannot be closed by itself. It needs the closing tag </clouds>. The icon tag cannot contain another tag and must be closed by itself with />.
gemini06720

Re: New: provide clouds from METAR station in the night

Post by gemini06720 »

gemini06720 wrote: A couple of questions:

- In your message you used the closing tag '</cloud>' - is it needed?
- When are closing tags needed?
- Can closing tags be used for all opening tags, such as '<pressure value="1015.0" unit="hPa"/></pressure>'?
Holli wrote:It's simple XML syntax convention:
Except so few programmers seem to repect any conventions now-a-day... :roll:
Holli wrote:All tags must be closed. Tags without content may be closed by itself, tags with content by a closing tag.
I am quite unfamiliar with XML and it seems whatever I read about XML does not want to register with my 'old' brain. Would it be asking too much of you to give me some examples as to when a closing tag is required and when a closing tag is not required, please... :oops:
Holli wrote:The clouds tag can contain the icon tag, so it's not empty and cannot be closed by itself. It needs the closing tag </clouds>. The icon tag cannot contain another tag and must be closed by itself with />.
Again, your explanation seems to have made my limited understanding of 'with closing tag/without closing tag' even more confused... :?
jmcmurry
Posts: 368
Joined: Tue Oct 13, 2009 11:09 am
Name: Jim
Location: Mauston, WI, USA
Contact:

Re: New: provide clouds from METAR station in the night

Post by jmcmurry »

gemini06720 wrote:Pasha, I just read about your addition of the cloud cover for nights...
FInally, is there a possibility that Rainer's 'cloud-base' PHP script could be adapted/used by PWS where cloud information is not available during the night period?
Yes, that is the plan, to use that and every other piece of information to provide current conditions as accurately as possible. Unfortunately, Rainer took a lightning strike that "tickled" him and then took out every electrical appliance in his home, so the project is on hold until everything gets sorted out.

I've seen some of his initial code and the direction that he is heading with it and it will be awesome. Just a little patience required at this point.

- Jim
Holli

Re: New: provide clouds from METAR station in the night

Post by Holli »

gemini06720 wrote:Again, your explanation seems to have made my limited understanding of 'with closing tag/without closing tag' even more confused... :?
Sorry. Let's try it with some concrete examples. Imagine XML tags as little boxes with covers, which you can put in other boxes and where you can put something in. Every box has its own closing cover. A very simple tag:

Code: Select all

<tag>
  content
</tag>
You see, a tag can have any content, and after the content it has to be closed. In a tag there can be other tags which have contents itself:

Code: Select all

<tag>
  <tag1>
    content
  </tag1>
  <tag2>
    content
  </tag2>
</tag>
A tag cannot be closed while another tag in it is still open. This is not allowed:

Code: Select all

<tag>
  <tag1>
    content
</tag>
  </tag1>
If you try this in realty with two boxes, you'll see, it won't work.

But tags not only may have content, they may have labels and stickers, too. These label are called attributes, and an attribute must have a value.

Code: Select all

<box content="socks">
  <box state="worn">
    socks
  </box> <!-- umm, please keep the cover closed -->
  <box state="washed">
    socks
  </box>
</box>
In some cases you don't need a box for content but only for an attribute. In this case it can be closed by itself:

Code: Select all

<note remember="wash the socks" />
At last, a box can have as many attributes as you want.

Code: Select all

<box content="socks">
  <box state="worn" level="full" cover="hermetic">
    many socks
  </box> <!-- umm, please keep the cover closed -->
  <note remember="wash the socks" priority="very urgent" /> <!-- no content, just a placeholder for two attributes -->
  <box state="washed" level="empty" cover="loose">
    one single sock
  </box>
</box>
I hope this will help understanding a little bit.
gemini06720

Re: New: provide clouds from METAR station in the night

Post by gemini06720 »

Holli wrote:I hope this will help understanding a little bit.
Indeed... I thought it was something like that, but I certainly was not sure...

One last (hopefully) question: When is it decided that 'a box' can be close without 'cover' - I know you wrote something about 'a box' containing only an attribute and no content - my understanding problem is probably because I see the attribute and the content as being both content in a way...

I really, really appreciate the time you have spent getting this mini-lesson together, and for that I thank you very much.

Since I am spending a lot of my time in PHP, I have not made a link between XML and PHP yet... :oops:
gemini06720

Re: New: provide clouds from METAR station in the night

Post by gemini06720 »

jmcmurry wrote:I've seen some of his initial code and the direction that he is heading with it and it will be awesome. Just a little patience required at this point.
Jim, I am not and was not pushing things... I was merely suggesting another possible option.

But now that you have 'slightly lifted the cover of the cookie jar' I can hardly wait for a pre-release... :twisted:

I have been using Rainer cloud-base script for some times ... I have even adapted the script to use Cumulus 'realtime.txt' file instead of Weather Display 'clientraw.txt' file... My way of getting more at ease with PHP... 8-)
Holli

Re: New: provide clouds from METAR station in the night

Post by Holli »

gemini06720 wrote:my understanding problem is probably because I see the attribute and the content as being both content in a way...
No, attributes a labels or stickers on top of the box. They are not content but an information what the box represents or contains.
gemini06720 wrote:Since I am spending a lot of my time in PHP, I have not made a link between XML and PHP yet... :oops:
If you are working with PHP you should know the basic rules of HTML and XHTML. XHTML is nothing other than HTML in XML syntax. While in HTML tags may stay unclosed. br or hr do not have closing tags, and even tags with content are autoclosed by the following tag if neccessary.

Code: Select all

<p>content<p>more content
is allowed in HTML. The unclosed first p is autoclosed by the following p. In XHTML this is a big error.

In XHTML every tag must be closed even if it has no content like <img src=".." />, <br /> or <hr />.

In the yowindow.xml the temperature or humidity tags have no content, but attributes. The wind tag has no attributes but contains other tags: speed and direction, which have itself no content, but attributes.

And the clouds tag has both: content and attributes.
User avatar
par
Posts: 8629
Joined: Mon Sep 21, 2009 11:56 am
Name: Pasha
Location: Saint-Petersburg, Russia
Contact:

Re: New: provide clouds from METAR station in the night

Post by par »

Holli, this is the easiest XML explanation I have ever read.
Box/stickers metaphor is excellent.
Next time I'm asked about XML I will direct the person to this topic.
Get YoWindow weather app for your phone or tablet.

Image Image Image
Post Reply