Australian BOM nicely centred non-scrolling Radar Loop on CTC

Discussion in 'Pascal Logic Code Examples' started by bmerrick, Jul 12, 2013.

  1. bmerrick

    bmerrick

    Joined:
    Jun 13, 2007
    Messages:
    434
    Likes Received:
    34
    Location:
    Sydney
    Hi All,

    Here is the method to create a single nicely centred non-scrolling radar loop on your CTC that is wholly created by the CTC. If you have a PC handy, you can use Brendan Roger's offered method which will create less load and memory use in your CTC. This is a stand-alone method using CTC resources.

    I call this version CTC_BOM-RL_5 v1.01 and the new version is CTC_BOM-RL_6. The reason for the long winded title is that I also have new CTC6 v 1.0 logic module almost ready (in final trialling) which keeps all the radars updated, ie all ranges, wind and rain radars. After a bit more testing I will be posting the up to 6 loop code as I am currently optimising the memory use and modifying for the BOM FTP site rather than the primary site.

    This version is quite basic compared to v6 but is probably best for someone who just want the main radar page for their area, for like a rain/no rain sort of analysis (take the umbrella today? at the front door perhaps). It is very reasonable with memory use.

    How it works:

    There are several elements to the method.

    1. A algorithmic radar image UTC time key generator - Timewatch module (previously generated using a page parser of the BOM site)

    2. A Local HTML page generator (MakeRadarFile module) that using procedures creates an HTML 'sandwich' made up of:
    - a Prefix HTML file - (the first half of the web page)
    - The output file which has the current radar loop image URLs generated by element 1.
    example [noparse]
    radarimages("ftp://ftp.bom.gov.au/anon/gen/radar/IDR713.T.201307111030.png","ftp://ftp.bom.gov.au/anon/gen/radar/IDR713.T.201307111036.png","ftp://ftp.bom.gov.au/anon/gen/radar/IDR713.T.201307111042.png","ftp://ftp.bom.gov.au/anon/gen/radar/IDR713.T.201307111048.png","ftp://ftp.bom.gov.au/anon/gen/radar/IDR713.T.201307111054.png","ftp://ftp.bom.gov.au/anon/gen/radar/IDR713.T.201307111100.png")[/noparse]

    - a Suffix HTML file to finish the web page (ie second half of web page)
    It uses the ReadPrefix and ReadSuffix procedures to import the HTML parts before re-assembling the output HTML page 'weatherradar.html'

    3. Coded into the HTML page is a small javascript slideshow that makes the image loop run

    4. An HTML element is inserted into a page on your CTC PICED project. You an adjust the size of the Window using the HTML element size and also in Prefix.html

    Every Six Minutes, the Timewatch procedure runs to create a new local 'weatherradar.html' file that contains the very latest number of images which are settable between 11 and 3 (I have made 6 the default, 1 more than BOM ie the last 30 minutes). It updates the file when the BOM image delay timer elapses ensuring you catch the very latest images as soon as they are posted.

    No images are actually transferred unless you are in the page with the HTML element, just an HTML page is built in the background READY to LOAD. This new version does not continually hit the BOM website to parse the image names, nor download anything until you have the actual page open.

    The whole complete web page file is weatherradar.html. See parts listed as Prefix.html, Suffix.html and Outputfile.html. I have had to put these files on my website as the forum system reads posted HTML and Javascript and runs it (??) even with the bb code noparse and code tags surrounding it. (If someone has a clue how to directly post an example HTML file on the forum, please let me know and I will update post.)

    To make this run, follow this procedure:

    I am calling it CTC_BOM-RL_5 v1.01. This new version you can leave on radar continuously with almost zero memory leakage. Of course this will not be usual operation.

    To be very memory frugal, you do however need to create your own background file for your area's radar, which is just a merged PNG of all the elements from the radar that you want, the usually tick boxed items on the BOM page. These are available here.


    As I can't upload HTML files here, I have put the latest files into a directory on our server in www.noushouse.com.au/CTC5 directory

    In your browser, just highlight each file and do a right mouse button 'Save Link As' into your PICED project directory.

    files that you will transfer to your CTC are:
    1. IDR713.backgroundmerged.png (this is the Sydney one - start with getting this working, then change to your zone etc)
    2. PrefixFile.html
    3. SuffixFile.html
    4. weatherradar.html (what the final file it creates every 6 minutes ends up like, put this into your on page HTML element in PICED - initially size to 540 x 480 you can change it later to whatever you want)

    other support files:
    5. Logic Summary.htm - is the logic modules report from PICED, containing the 2 logic modules, 2 procedures, initialisation and Global variables you need to add to your PICED project.
    6. CTC5_version.txt - just a file with the latest version number and log of issues and fixes.

    To start off, just make a project with a page with a HTML element pointed at C:\weatherradar.html. It should load OK in simulation mode. Create all the logic elements (modules, procedures, initialisation and global variables) noted in the Logic Summary file.
    When you upload the project to a CTC screen you just need to also set it to upload the 4 files.


    Current Issues:
    1. Had to change 'For Do' loops to 'While Dos' as the logic engine seemed to ignore the For Do after project became a certain size for reasons unknown and currently undiagnosed. Put in While Dos, but that just made it use slightly more processor and have much messier code. Will fix in later version.

    2. Background image currently needs to be separately combined by downloading topography, locations and background (as z-index, CSS and other normal mechanisms aren't working to overlay transparencies and chew up too much extra RAM anyway). I just used Illustrator but Paint Shop etc is fine.

    3. Overlay image of radar range - still to update


    I would like to hand this method over to the community and welcome suggestions of code changes and enhancements and I will incorporate them and release these acknowledged in the CTC5_version.txt file.

    The method runs well in PICED in simulation mode so test it and get working in there before you transfer to CTC. Look in the log for program cues being logged. Additional testing log entry lines are built into the code. remove '//' comment prefixes from lines to log that lines output to the log file for testing purposes if required.

    To use this method, as discussed in the previous post, you will need to sign a Bureau Access Agreement, a fairly simple procedure you can start emailing Bureau's copyright officer: [email protected]. At this time, all users must apply for a BOM bureau access agreement for continued use to comply with copyright requirements of BOM. Please be aware you need to accept personal responsibility for ensuring you and your client's copyright compliance. Downloading files and use of the method constitutes your agreement.

    Also, any issues, questions, critiques, code suggestions, please PM me. There is plenty of information in comments within the logic and HTML files.

    Enjoy & I hope it works well for you.

    Brad :) :cool:
     
    bmerrick, Jul 12, 2013
    #1
  2. bmerrick

    bmerrick

    Joined:
    Jun 13, 2007
    Messages:
    434
    Likes Received:
    34
    Location:
    Sydney
    Updated Method

    Hi All,

    Thanks for the great feedback. I have pulled back some features I had already put into CTC6 to make CTC5 better as many of Brendan's questions/issue had already been addressed in CTC6.


    v1.02
    Whats New:
    1. Adjusted timers in SuffixFile.html to make image movement more fluid.
    2. Added #radarbackground and #radarforeground CSS styles to allow images of range, topography, location to be easily added in PrefixHTML body. Users can add any transparencies they want into the #radarxxxxground DIVs. I suggest that you combine multiple overlays into a single foreground and background file to reduce memory usage. (fix of V1.01 #2 & #3 issue)
    3. Changed positioning from fixed to absolute to combat IE positioning bug to allow #2 to work
    4. Adjusted some window sizes in Prefix to make output look more like standard BOM radar image (to address feedback from Brendan Rogers)

    Notes:
    1. If you want a nice looking image without the timestamps - use width 496 height 496 in the #radarbackground, #radarforeground & #radargallery img CSS.
    2. If you want a full resized duplicate of BOMs radar page with Timestamp - use width 470 height 470 in the #radarbackground, #radarforeground & #radargallery img CSS.
    3. For #1 and #2 sizing, set HTML element size to 480x480(#1) or 496x480(#2)
    4. If you are using individual transparencies for location, topography, range etc, don't forget to upload them to CTC when you do your transfer.

    Current Issues:

    1. need tweak to algorithm slightly as it created - [noparse]ftp://ftp.bom.gov.au/anon/gen/radar/IDR713.T.201307132400.png[/noparse] - hour needs fix
    2. v1.01 issues #1


    The Files:
    Logic Summary.htm
    IDR713.range.png
    IDR713.locations.png
    IDR713.topography.png
    IDR713.background.png
    PrefixFile.html
    CTC5_version.txt
    SuffixFile.html
    weatherradar.html
    I have updated the files to CTC5-V1.02:

    In your browser, just highlight each file and do a right mouse button 'Save Link As' into your PICED project directory.

    files that you will transfer to your CTC are:
    1. PrefixFile.html
    2. SuffixFile.html
    3. weatherradar.html (what the final file it creates every 6 minutes ends up like, put this into your on page HTML element in PICED - initially size to 496w x 480h you can change it later to whatever you want)
    4. IDR713.background.png (this is the Sydney one - start with getting this working, then change to your zone etc)
    5. IDR713.topography.png (this is the Sydney one - start with getting this working, then change to your zone etc)
    6. IDR713.locations.png (this is the Sydney one - start with getting this working, then change to your zone etc)
    7. IDR713.range.png (this is the Sydney one - start with getting this working, then change to your zone etc)

    other support files:
    8. Logic Summary.htm - is the logic modules report from PICED, containing the 2 logic modules, 2 procedures, initialisation and Global variables you need to add to your PICED project. LOGIC IS UNCHANGED FOR v1.02 ie same as v1.01
    9. CTC5_version.txt - just a file with the latest version number and log of issues, notes and fixes. PLEASE READ - UPDATED


    Brendan, you are correct, you can make it change as fast as you like. The Javascript window changer is micro and so also very fast. You can also update the radarindex:=6; variable in initialisation to 11 (current tested max) to give you 11 images in the loop. Try it with more and see if it breaks!! :p I think it will as current logic can only go past one hourly boundary in UTC calc.

    In answering your comment regarding sizing and positioning, I have added further notes to PrefixFile.html to give installers/users more information about sizing, but really I see sizing and positioning of the file image loop as being the domain of you, the installer to adjust it to properly fit within your template running and any bespoke menu buttons your are using.

    Anyway, hope that update addresses most of the issues. There is a small 7 image issue at UTC time day change that I am yet to test the resolution of. I don't want to send out modified code until it is tested. Logic remains unchanged from v1.01 so you don't need to change anything there.

    Brendan, thanks for confirming it is working well on your CTC3 (Phew! - that's a relief). I have it running nicely on the CTC2

    To get you guys thinking of further uses of the 'Stuff the HTML sandwich' technique, you could easily write a sequential number incrementer to replace 'Timewatch' and have it pull down images from a private server for a picture slideshow eg. IMG_9001,IMG_9002,IMG_9003 etc.

    To use this method, as discussed in the initial method post, you will need to sign a Bureau Access Agreement, a fairly simple procedure you can start emailing Bureau's copyright officer: [email protected]. At this time, all users must apply for a BOM bureau access agreement for continued use to comply with copyright requirements of BOM. Please be aware you need to accept personal responsibility for ensuring you and your client's copyright compliance. Downloading files and use of the method constitutes your agreement.

    Good Luck with the update. Any feedback, please PM or email me,

    Brad
     
    bmerrick, Jul 17, 2013
    #2
  3. bmerrick

    pspeirs

    Joined:
    Nov 23, 2013
    Messages:
    185
    Likes Received:
    10
    Location:
    Sydney
    Hi,

    Is this project still available?

    Cheers,
    Paul
     
    pspeirs, Jan 2, 2015
    #3
  4. bmerrick

    bmerrick

    Joined:
    Jun 13, 2007
    Messages:
    434
    Likes Received:
    34
    Location:
    Sydney

    Hi Paul,

    I just checked and the files are still on my server. Are you having an issue downloading them with the links?

    The project has not progressed beyond these 'latest' files.

    I haven't got my test screen at the moment (as it is filling in at a client's site at the moment as a spare) or I would give it a test for you to see it is still operating. Obviously it relies on BOMs site not having changed for file access, which it could have in the intervening period since it was posted.

    Will try it when my screen comes back but let me know if you can't get the files.

    all the best,

    Brad
     
    bmerrick, Jan 19, 2015
    #4
  5. bmerrick

    pspeirs

    Joined:
    Nov 23, 2013
    Messages:
    185
    Likes Received:
    10
    Location:
    Sydney
    Hi Brad,
    Thanks for the reply. Things very busy here moving into the new place. I looked at the project tonight but couldn't get it all working. I can bring up the images however there is a small black cross on the top left of the html screen that appears to be a Javascript error perhaps. I'm using the colour touch CTC2 if that helps.

    Regards,
    Paul
     
    pspeirs, Jan 30, 2015
    #5
  6. bmerrick

    pspeirs

    Joined:
    Nov 23, 2013
    Messages:
    185
    Likes Received:
    10
    Location:
    Sydney
    pspeirs, Jan 30, 2015
    #6
  7. bmerrick

    bmerrick

    Joined:
    Jun 13, 2007
    Messages:
    434
    Likes Received:
    34
    Location:
    Sydney
    Hi Paul,

    I am out all weekend but will have a look at it early next week and get back to you. It works OK on a CTC2 but is better with the more memory on a CTC3.

    In the meantime, you might want to look at the time assembling logic and make sure it is looking for the correct time code on BOMs server.

    Brad
     
    bmerrick, Jan 30, 2015
    #7
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.