New: provide clouds from METAR station in the night
- 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
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!
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!
Re: New: provide clouds from METAR station in the night
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:
that means that my station is providing the cloud information 24/7, whereas if I use the following:
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:
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?
Just to make sure I understand correctly the modifications, if I use the following:
Code: Select all
<clouds value="partlyCloudy"/>
Code: Select all
<clouds value="partlyCloudy" include="daylight">
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">
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?
Re: New: provide clouds from METAR station in the night
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.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>'?
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 />.
Re: New: provide clouds from METAR station in the night
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>'?
Except so few programmers seem to repect any conventions now-a-day...Holli wrote:It's simple XML syntax convention:
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...Holli wrote:All tags must be closed. Tags without content may be closed by itself, tags with content by a closing tag.
Again, your explanation seems to have made my limited understanding of 'with closing tag/without closing tag' even more confused... :?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 />.
Re: New: provide clouds from METAR station in the night
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.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?
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
Re: New: provide clouds from METAR station in the night
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:gemini06720 wrote:Again, your explanation seems to have made my limited understanding of 'with closing tag/without closing tag' even more confused... :?
Code: Select all
<tag>
content
</tag>
Code: Select all
<tag>
<tag1>
content
</tag1>
<tag2>
content
</tag2>
</tag>
Code: Select all
<tag>
<tag1>
content
</tag>
</tag1>
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>
Code: Select all
<note remember="wash the socks" />
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>
Re: New: provide clouds from METAR station in the night
Indeed... I thought it was something like that, but I certainly was not sure...Holli wrote:I hope this will help understanding a little bit.
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...
Re: New: provide clouds from METAR station in the night
Jim, I am not and was not pushing things... I was merely suggesting another possible option.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.
But now that you have 'slightly lifted the cover of the cookie jar' I can hardly wait for a pre-release...
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...
Re: New: provide clouds from METAR station in the night
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:my understanding problem is probably because I see the attribute and the content as being both content in a way...
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.gemini06720 wrote:Since I am spending a lot of my time in PHP, I have not made a link between XML and PHP yet...
Code: Select all
<p>content<p>more content
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.
- 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
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.
Box/stickers metaphor is excellent.
Next time I'm asked about XML I will direct the person to this topic.