Hi Darryn, Peter,

Dropping weewx-user from the reply all list, adding weewx-development as
the (probably) more appropriate place for this post.

Firstly, Nice work Darryn. The page *is* responsive and the forecasts all
being in the one place and accessible like this saves a lot of clicks.

----

The following are my notes on the installation of Darryn's Responsive skin
at https://github.com/dcapslock/weewx-responsive-skin and its inclusion of
the BOM Australian forecasts. The original thread is over on weewx-user at
https://groups.google.com/forum/#!topic/weewx-user/-Rf9A_5Okds

Current installation instructions are at https://github.com/dcapslock/
weewx-responsive-skin/wiki/Australian-'Search'-Extensions


=======================

Dependency to install - python-tz to remedy   ****  ImportError: No module
named pytz
Needed only for the timezone? so it might dissappear when the ToDo entry
regarding time is ticked off?

[...]
Oct  9 09:25:40 masterofpis weewx[14358]:         ****    File
"/usr/share/weewx/user/aussearch.py", line 2, in <module>
Oct  9 09:25:40 masterofpis weewx[14358]:         ****      import pytz
Oct  9 09:25:40 masterofpis weewx[14358]:         ****  ImportError: No
module named pytz
Oct  9 09:25:40 masterofpis weewx[14358]:         ****  Generator terminated


pi@masterofpis:~$ sudo apt-get install python-tz

Ah, and edited aussearch.py to swap out Sydney for Melbourne, even though
we are the same timezone.

=======================

Couldn't find anything to fix the cself error (see below) so I used mkdir
to circumvent the call. What is cself? I couldn't find a reference to it
anywhere Searched Debian packages with no joy - google turned up zilch.

mkdir /var/lib/weewx/aussearch

[...]
Oct  9 09:50:32 masterofpis weewx[18899]:         ****
 self.initExtensions(gen_dict[section_name])
Oct  9 09:50:32 masterofpis weewx[18899]:         ****    File
"/usr/share/weewx/weewx/cheetahgenerator.py", line 188, in initExtensions
Oct  9 09:50:32 masterofpis weewx[18899]:         ****
 self.search_list_objs.append(class_(self))
Oct  9 09:50:32 masterofpis weewx[18899]:         ****    File
"/usr/share/weewx/user/aussearch.py", line 89, in __init__
Oct  9 09:50:32 masterofpis weewx[18899]:         ****
 os.makedirs(cself.cache_root)
Oct  9 09:50:32 masterofpis weewx[18899]:         ****  NameError: global
name 'cself' is not defined
Oct  9 09:50:32 masterofpis weewx[18899]:         ****  Generator terminated

        try:
            self.cache_root = self.generator.skin_dict['
AusSearch']['cache_root']
        except KeyError:
            self.cache_root = '/var/lib/weewx/aussearch'

        try:
            self.staleness_time = float(self.generator.skin_
dict['AusSearch']['staleness_time'])
        except KeyError:
            self.staleness_time = 15 * 60 #15 minutes

        if not os.path.exists(self.cache_root):
            os.makedirs(cself.cache_root)


================

Now, the pointy end of the stick.
This took quite a while to do as I'm a little different to the Capital city
example - I'm in Regional Victoria - so the page layouts don't quite
correlate. Plus there is a lot of substituting to do and Cheetah is not
very friendly when a mistake is made.
I have it working though, well enough to get a result that makes sense.
There will always be tweaking and a search for better source pages amongst
the myriad of files the BOM have listed, but I'm pretty happy with the
result so far.
Something I need to do is duplicate the detailed forecast page and
introduce a second forecast area. Where we live falls between two zones so
the forecasts can be quite different, especially between work and home!

Because the pages didn't correlate (SYDNEY had 2 identities depending on
whether forecast.html.tmpl or index-forecast. tmpl was being populated); I
ended up giving them different names, ones that reflected the section that
they were filling. That made it a lot easier after I realized what was
happening, where it was displaying the full forecast in the index summary.
This way I could allocate each area its own xxx.xml source file.
The variable names I used are as follows...

NSWMETRO -> BOMAROUND named, and used to populate the "Around XXX" table in
forecast.html (forecast.html.tmpl)
SYDNEY -> BOMDETAIL named and used to populate the "Detailed Forecast"
table in forecast.html  (forecast.html.tmpl)
SYDNEY -> BOMSUMMARY named and used to populate the "Forecast" table in
index.forecast (index-forecast.tmpl)
NSWWARNING -> BOMWARNING just to follow the pattern -
Bureau(BOM)|Description(WARNING)


  BOMAROUND = ftp://ftp.bom.gov.au/anon/gen/fwo/IDV10753.xml
  BOMDETAIL = ftp://ftp.bom.gov.au/anon/gen/fwo/IDV10705.xml
  BOMSUMMARY = ftp://ftp.bom.gov.au/anon/gen/fwo/IDV10753.xml
  BOMWARNINGS = http://www.bom.gov.au/fwo/IDZ00066.warnings_land_vic.xml

As it turns out I could use (my) BOMDETAIL in place of BOMSUMMARY (just as
originally done) but edits are required in index-forecast.tmpl

line 48 which was...

-<strong>$FC.getNode('forecast-period',index=$fcIndex).text</strong>

needs changing to...

+<strong>$FC.getNode('forecast-period',index=$fcIndex).getNode('text',type="
precis")</strong>

which then picks up the short summary from the supplied BOMDETAIL. That's a
bit more involved than creating a new variable (BOMSUMMARY) though,
especially if you're new to editing, or it's not your day job.


The diffs between Parramatta and Ballarat's configs are available in the
attachments to this post.

I should add that the "nearby" towns in the forecast.html page do need to
be adjusted as they are nowhere near us. They served well as place fillers
though.



================

appTemp - I haven't looked at this yet but I gather that this was fixed or
something in 3.6.0 - which I'm now running.

It appears to be baulking because I don't have that field in the database,
 so I've got a lot more research to do it would seem.

Oct  9 11:32:45 masterofpis weewx[11532]:         ****  (1054, "Unknown
column 'appTemp' in 'field list'")
Oct  9 11:32:45 masterofpis weewx[11532]:         ****  Traceback (most
recent call last):
Oct  9 11:32:45 masterofpis weewx[11532]:         ****    File
"/usr/share/weewx/weewx/reportengine.py", line 238, in run
Oct  9 11:32:45 masterofpis weewx[11532]:         ****      obj.start()
Oct  9 11:32:45 masterofpis weewx[11532]:         ****    File
"/usr/share/weewx/weewx/reportengine.py", line 271, in start
Oct  9 11:32:45 masterofpis weewx[11532]:         ****      self.run()
Oct  9 11:32:45 masterofpis weewx[11532]:         ****    File
"/usr/share/weewx/weewx/imagegenerator.py", line 31, in run
Oct  9 11:32:45 masterofpis weewx[11532]:         ****
 self.genImages(self.gen_ts)
Oct  9 11:32:45 masterofpis weewx[11532]:         ****    File
"/usr/share/weewx/weewx/imagegenerator.py", line 141, in genImages
Oct  9 11:32:45 masterofpis weewx[11532]:         ****
 aggregate_interval=aggregate_interval)
Oct  9 11:32:45 masterofpis weewx[11532]:         ****    File
"/usr/share/weewx/weewx/manager.py", line 496, in getSqlVectors
Oct  9 11:32:45 masterofpis weewx[11532]:         ****      aggregate_type,
aggregate_interval)
Oct 9 11:32:45 masterofpis weewx[11532]:         ****    File
"/usr/share/weewx/weewx/manager.py", line 742, in _getSqlVectors
Oct  9 11:32:45 masterofpis weewx[11532]:         ****      for _rec in
_cursor.execute(sql_str, (startstamp, stopstamp)):
Oct  9 11:32:45 masterofpis weewx[11532]:         ****    File
"/usr/share/weewx/weedb/mysql.py", line 29, in guarded_fn
Oct  9 11:32:45 masterofpis weewx[11532]:         ****      raise
weedb.OperationalError(e)
Oct  9 11:32:45 masterofpis weewx[11532]:         ****  OperationalError:
(1054, "Unknown column 'appTemp' in 'field list'")
Oct  9 11:32:45 masterofpis weewx[11532]:         ****  Generator terminated



Cheers
 Glenn

rorpi-raspberry pi + weewx: now with scripts
<https://github.com/glennmckechnie/rorpi-raspberrypi>
--- index-forecast.tmpl.org     2016-10-09 22:39:07.000000000 +1100
+++ index-forecast.tmpl 2016-10-10 12:03:25.535147599 +1100
@@ -4,6 +4,8 @@
 ## Depending of your location and XML file in skin.conf
 ## you will need to adjust this file in a few places
 ##
+##set $FC = $aus.BOMSUMMARY.forecast('area',description="Ballarat")
+##Forecast for Ballarat<br/>
 #import dateutil.parser
 <div class="panel panel-primary">
   <div class="panel-heading">
@@ -14,59 +16,59 @@
     </h4>
   </div>
   <div class="panel-collapse collapse" id="collapseAccTwoFive">
-   ## Chane to your location. YOu may also need to change the XML file being 
used.
-   #set $FC = $aus.NSWMETRO.forecast('area',description="Parramatta")
+    ## Chane to your location. YOu may also need to change the XML file being 
used.
+    #set $FC = $aus.BOMSUMMARY.forecast('area',description="Ballarat")
     <div class="panel-body">
-    <h6><small>
-    #set $issueDateTime = $aus.NSWMETRO.amoc.issue__time__local.string
-    Forecast for Parramatta<br/>
-    Issued at $dateutil.parser.parse($issueDateTime).strftime("%I:%M%p") 
$aus.NSWMETRO.amoc.issue__time__local.tz on 
$dateutil.parser.parse($issueDateTime).strftime("%a %-d %b %Y")
-    </small></h6>
+      <h6><small>
+      #set $issueDateTime = $aus.BOMSUMMARY.amoc.issue__time__local.string
+      Forecast for Ballarat - not precis<br/>
+      Issued at $dateutil.parser.parse($issueDateTime).strftime("%I:%M%p") 
$aus.BOMSUMMARY.amoc.issue__time__local.tz on 
$dateutil.parser.parse($issueDateTime).strftime("%a %-d %b %Y")
+      </small></h6>
       <table class="table table-condensed table-responsive">
         <tbody>
-     #for $fcCount in range(7)
-       #set $fcIndex = str($fcCount)
-       #if $FC.getNode('forecast-period',index=$fcIndex) is not None
-        <tr>
-         #if $fcIndex == "0"
-          <td class="text-primary" colspan="2">
-           Forecast for the rest of 
$dateutil.parser.parse($FC.getNode('forecast-period',index=$fcIndex).start__time__local).strftime("%A")
-          </td>
-         #else
-          <td class="text-primary" colspan="2">
-           
$dateutil.parser.parse($FC.getNode('forecast-period',index=$fcIndex).start__time__local).strftime("%A
 %-d %b")
-          </td>
-         #end if
-        </tr>
-        <tr>
-         <td>
-          <img 
src="$aus.icons[$FC.getNode('forecast-period',index=$fcIndex).getNode('element',type="forecast_icon_code").string]"
 />
-         </td>
-         <td>
-          <strong>$FC.getNode('forecast-period',index=$fcIndex).text</strong>
-          #if 
$FC.getNode('forecast-period',index=$fcIndex).getNode('element',type="air_temperature_minimum")
 is not None
-           <br/><small>Min</small> <strong><span style="color: 
blue">$FC.getNode('forecast-period',index=$fcIndex).getNode('element',type="air_temperature_minimum")</span></strong>
-          #else
-           <br/>
-          #end if
-          #if 
$FC.getNode('forecast-period',index=$fcIndex).getNode('element',type="air_temperature_maximum")
 is not None
-           <small>Max</small> <strong><span style="color: 
red">$FC.getNode('forecast-period',index=$fcIndex).getNode('element',type="air_temperature_maximum")</span></strong>
-          #end if
-         </td>
-        </tr>
-       #end if
-      #end for
-      <tr>
-       <td colspan="2" style="text-align: right">
-        <a href="forecast.html">Full Forecast</a>
-       </td>
-      </tr>
+        #for $fcCount in range(7)
+            #set $fcIndex = str($fcCount)
+            #if $FC.getNode('forecast-period',index=$fcIndex) is not None
+              <tr>
+                #if $fcIndex == "0"
+                  <td class="text-primary" colspan="2">
+                    Forecast for the rest of 
$dateutil.parser.parse($FC.getNode('forecast-period',index=$fcIndex).start__time__local).strftime("%A")
+                  </td>
+                #else
+                  <td class="text-primary" colspan="2">
+                    
$dateutil.parser.parse($FC.getNode('forecast-period',index=$fcIndex).start__time__local).strftime("%A
 %-d %b")
+                  </td>
+                #end if
+              </tr>
+              <tr>
+                <td>
+                  <img 
src="$aus.icons[$FC.getNode('forecast-period',index=$fcIndex).getNode('element',type="forecast_icon_code").string]"
 />
+                </td>
+                <td>
+                  
<strong>$FC.getNode('forecast-period',index=$fcIndex).getNode('text',type="precis")</strong>
+                  #if 
$FC.getNode('forecast-period',index=$fcIndex).getNode('element',type="air_temperature_minimum")
 is not None
+                    <br/><small>Min</small> <strong><span style="color: 
blue">$FC.getNode('forecast-period',index=$fcIndex).getNode('element',type="air_temperature_minimum")</span></strong>
+                  #else
+                    <br/>
+                  #end if
+                  #if 
$FC.getNode('forecast-period',index=$fcIndex).getNode('element',type="air_temperature_maximum")
 is not None
+                    <small>Max</small> <strong><span style="color: 
red">$FC.getNode('forecast-period',index=$fcIndex).getNode('element',type="air_temperature_maximum")</span></strong>
+                  #end if
+                </td>
+              </tr>
+            #end if
+          #end for
+          <tr>
+            <td colspan="2" style="text-align: right">
+              <a href="forecast.html">Full Forecast</a>
+            </td>
+          </tr>
         </tbody>
       </table>
-    <h6><small>
-    #set $nextIssueDateTime = 
$aus.NSWMETRO.amoc.next__routine__issue__time__local.string
-    The next routine forecast will be issue at 
$dateutil.parser.parse($nextIssueDateTime).strftime("%I:%M%p") 
$aus.NSWMETRO.amoc.next__routine__issue__time__local.tz 
$dateutil.parser.parse($nextIssueDateTime).strftime("%A")
-    </small></h6>
+      <h6><small>
+      #set $nextIssueDateTime = 
$aus.BOMSUMMARY.amoc.next__routine__issue__time__local.string
+      The next routine forecast will be issue at 
$dateutil.parser.parse($nextIssueDateTime).strftime("%I:%M%p") 
$aus.BOMSUMMARY.amoc.next__routine__issue__time__local.tz 
$dateutil.parser.parse($nextIssueDateTime).strftime("%A")
+      </small></h6>
     </div>
   </div>
 </div>

Attachment: skin.conf.diff.w2w3
Description: Binary data

Attachment: index-forecast.tmpl.diff.w3.precis
Description: Binary data

Attachment: forcast.html.tmpl.diff.w3
Description: Binary data

Reply via email to