You are not logged in.
MrPeachy:
Are weather radar maps a dead issue? I haven't been following this thread too closely.
Thanks.
I havnt done much else with the maps for a while but Ive been thinking about them and how to best implement them
ill put some thought into it over the next couple of days
Offline
try this in a template, and if all goes according to plan, i will add it to wun.lua
as the first line of the template put this
getmap=1--fetches map on startup and template resave
then here is the function, it can either go at the top of the template file, below that line and before the weather setup begins, or it can go at the very bottom of the file.
function weathermap(mapt)
local mapx=mapt.x or 0
local mapy=mapt.y or 0
local mykey=mapt.apikey
local dloc=mapt.dloc or pathtowun.."weathermap/"
local fname="weathermap"
local lon=mapt.lon or now.location_longitude
local lat=mapt.lat or now.location_latitude
local irad=mapt.rad or 200
local iwid=mapt.w or 400
local ihig=mapt.h or 200
--satellite stuff first
local srdu=mapt.unit or "km"
local satt=mapt.stype or "sat_vis"
local gtt=mapt.gtt or 107
local bmap=0
local sbrd=mapt.sborder or 1
local smth=mapt.smooth or 1
local proj=mapt.project or "ll"
local tmlbs=0
local tmlbsy=0
local tmlbsx=0
--radar stuff
local tmlbr=mapt.label or 1
local tmlbry=mapt.ly or 10
local tmlbrx=mapt.lx or 10
local nmap=mapt.basemap or 1
local rnsn=mapt.rainsnow or 1
local nocl=mapt.noclutter or 1
local update=mapt.update or 60
--timer #################################
local updates=tonumber(conky_parse('${updates}'))
local timer=(updates %tonumber(update))
--#######################################
if getmap==1 or timer==0 then
print ("updating map")
local f=io.popen("ls "..dloc)
for l in f:lines() do
os.remove(dloc..l)
end
f:close()
timestamp=tostring(os.date("%d%H%M%S"))
local dloc=dloc..fname..timestamp..".gif"
local saturl="http://api.wunderground.com/api/"..mykey.."//radar/satellite/image.gif?rad.centerlat="..lat.."&rad.centerlon="..lon.."&sat.centerlat="..lat.."&sat.centerlon="..lon.."&rad.radius="..irad.."&rad.width="..iwid.."&rad.height="..ihig.."&sat.radius="..irad.."&sat.width="..iwid.."&sat.height="..ihig.."&sat.radunits="..srdu.."&sat.key="..satt.."&sat.gtt="..gtt.."&sat.basemap="..bmap.."&sat.borders="..sbrd.."&sat.smooth="..smth.."&sat.proj="..proj.."&sat.timelabel="..tmlbs.."&sat.timelabel.x="..tmlbsx.."&sat.timelabel.y="..tmlbsy.."&rad.radunits="..srdu.."&rad.newmaps="..nmap.."&rad.rainsnow="..rnsn.."&rad.smooth="..smth.."&rad.proj="..proj.."&rad.timelabel="..tmlbr.."&rad.timelabel.x="..tmlbrx.."&rad.timelabel.y="..tmlbry.."&rad.noclutter="..nocl..""
local f=io.popen("wget -q -O "..dloc.." '"..saturl.."'")
f:close()
end--if getmap
getmap=nil
image({x=mapx,y=mapy,w=iwid,h=ihig,file=dloc..fname..timestamp..".gif"})
end--map function
then in the template weather setup use the function like this
weathermap({
update=60,--update interval in conky cycles
x=20,--map coordinates
y=200,--map coordinates
apikey="key",--yourapikey, using this function is an additional use of the api key
dloc=pathtowun.."weathermap/",--download location
lon=now.location_longitude,--longitude
lat=now.location_latitude,--latitude
rad=200,--radius of map data
w=400,--width of map
h=200,--height of map
unit="km",--units, "km" or "nm" (nautical miles)
stype="sat_vis",--satellite map type "sat_ir4" or "sat_vis"
gtt=107,--0 - 255 Ground temperature threshhold. Level to cutoff and leave transparent. 107 is a reasonable value to show clouds but hide land.
sborder=1,--border, 1 or 0
smooth=1,--smooth colors 1 or 0
project="ll",--"ll" or "me" Lat/lon projection or Mercator projection
basemap=1,--show basemap, 1 or 0
rainsnow=1,--rain and snow different 1, or 0
noclutter=1,--1 or 0
label=1,--timelabel 1 or 0
ly=10,--label coordinates
lx=10,--label coordinates
})
you can only get one map at a time for right now
EDIT - hold on using that for a minute, got to fix something!!
EDIT2 - ok, now it should work
Last edited by mrpeachy (2014-02-13 19:31:21)
Offline
EDIT - hold on using that for a minute, got to fix something!!
Says the bullet after leaving the gun.
Success is 1% Inspiration
and 98% Perspiration and
2% atttention to details.
Offline
well its mostly working, for some reason every now and again it is fetching a map with a transparent background
ill have to see if i can track that problem down
Offline
here is my map working along with some prototype graphs, red one is temp for next 36 hours, green one is dew
Offline
mrpeachy wrote:EDIT - hold on using that for a minute, got to fix something!!
Says the bullet after leaving the gun.
OH!! that's a keeper!
Famous Quotes #276534.
· ↓ ↓ ↓ ↓ ↓ ↓ ·
BunsenLabs Forums now Open for Registration
· ↑ ↑ ↑ ↑ ↑ ↑ · BL ModSquad
Offline
here is my map working along with some prototype graphs, red one is temp for next 36 hours, green one is dew
http://s23.postimg.org/ao6dkxnzr/Screenshot_from_2014_02_13_14_10_44.jpg
NICE!!! Hope you get it working.
· ↓ ↓ ↓ ↓ ↓ ↓ ·
BunsenLabs Forums now Open for Registration
· ↑ ↑ ↑ ↑ ↑ ↑ · BL ModSquad
Offline
Well, I am ashamed to say this, I can't figure out where these code snippets go.
I'm using wunrci and that is using the ~/wun/templates/iweather_falldown.lua "call".
Success is 1% Inspiration
and 98% Perspiration and
2% atttention to details.
Offline
Well, I am ashamed to say this, I can't figure out where these code snippets go.
I'm using wunrci and that is using the ~/wun/templates/iweather_falldown.lua "call".
This is how I read what to do.
iweather_falldown.lua starts like:
-- put it right at the top, before the template code starts ------------------
-- start daytime
function daytime(sr,ss)
according to mrpeachy this will work:
getmap=1--fetches map on startup and template resave
function weathermap(mapt)
local mapx=mapt.x or 0
local mapy=mapt.y or 0
local mykey=mapt.apikey
local dloc=mapt.dloc or pathtowun.."weathermap/"
local fname="weathermap"
local lon=mapt.lon or now.location_longitude
local lat=mapt.lat or now.location_latitude
local irad=mapt.rad or 200
local iwid=mapt.w or 400
local ihig=mapt.h or 200
--satellite stuff first
local srdu=mapt.unit or "km"
local satt=mapt.stype or "sat_vis"
local gtt=mapt.gtt or 107
local bmap=0
local sbrd=mapt.sborder or 1
local smth=mapt.smooth or 1
local proj=mapt.project or "ll"
local tmlbs=0
local tmlbsy=0
local tmlbsx=0
--radar stuff
local tmlbr=mapt.label or 1
local tmlbry=mapt.ly or 10
local tmlbrx=mapt.lx or 10
local nmap=mapt.basemap or 1
local rnsn=mapt.rainsnow or 1
local nocl=mapt.noclutter or 1
local update=mapt.update or 60
--timer #################################
local updates=tonumber(conky_parse('${updates}'))
local timer=(updates %tonumber(update))
--#######################################
if getmap==1 or timer==0 then
print ("updating map")
local f=io.popen("ls "..dloc)
for l in f:lines() do
os.remove(dloc..l)
end
f:close()
timestamp=tostring(os.date("%d%H%M%S"))
local dloc=dloc..fname..timestamp..".gif"
local saturl="http://api.wunderground.com/api/"..mykey.."//radar/satellite/image.gif?rad.centerlat="..lat.."&rad.centerlon="..lon.."&sat.centerlat="..lat.."&sat.centerlon="..lon.."&rad.radius="..irad.."&rad.width="..iwid.."&rad.height="..ihig.."&sat.radius="..irad.."&sat.width="..iwid.."&sat.height="..ihig.."&sat.radunits="..srdu.."&sat.key="..satt.."&sat.gtt="..gtt.."&sat.basemap="..bmap.."&sat.borders="..sbrd.."&sat.smooth="..smth.."&sat.proj="..proj.."&sat.timelabel="..tmlbs.."&sat.timelabel.x="..tmlbsx.."&sat.timelabel.y="..tmlbsy.."&rad.radunits="..srdu.."&rad.newmaps="..nmap.."&rad.rainsnow="..rnsn.."&rad.smooth="..smth.."&rad.proj="..proj.."&rad.timelabel="..tmlbr.."&rad.timelabel.x="..tmlbrx.."&rad.timelabel.y="..tmlbry.."&rad.noclutter="..nocl..""
local f=io.popen("wget -q -O "..dloc.." '"..saturl.."'")
f:close()
end--if getmap
getmap=nil
image({x=mapx,y=mapy,w=iwid,h=ihig,file=dloc..fname..timestamp..".gif"})
end--map function
-- put it right at the top, before the template code starts ------------------
-- start daytime
function daytime(sr,ss)
Now in the "weather setup" area - - - this looks like a good spot:
-- ## DISPLAY FUNCTION ######## DISPLAY FUNCTION ######## DISPLAY FUNCTION ###
_G.weather_script = function(update,time,now,text_forecast,day,hour,alerts)
-- ### ↑ DO NOT EDIT THIS LINE ↑ ↑ DO NOT EDIT THIS LINE ↑ ##################
right here ....
-- ###########################################################################
add this:
-- ## DISPLAY FUNCTION ######## DISPLAY FUNCTION ######## DISPLAY FUNCTION ###
_G.weather_script = function(update,time,now,text_forecast,day,hour,alerts)
-- ### ↑ DO NOT EDIT THIS LINE ↑ ↑ DO NOT EDIT THIS LINE ↑ ##################
weathermap({
update=60,--update interval in conky cycles
x=20,--map coordinates
y=200,--map coordinates
apikey="key",--yourapikey, using this function is an additional use of the api key
dloc=pathtowun.."weathermap/",--download location
lon=now.location_longitude,--longitude
lat=now.location_latitude,--latitude
rad=200,--radius of map data
w=400,--width of map
h=200,--height of map
unit="km",--units, "km" or "nm" (nautical miles)
stype="sat_vis",--satellite map type "sat_ir4" or "sat_vis"
gtt=107,--0 - 255 Ground temperature threshhold. Level to cutoff and leave transparent. 107 is a reasonable value to show clouds but hide land.
sborder=1,--border, 1 or 0
smooth=1,--smooth colors 1 or 0
project="ll",--"ll" or "me" Lat/lon projection or Mercator projection
basemap=1,--show basemap, 1 or 0
rainsnow=1,--rain and snow different 1, or 0
noclutter=1,--1 or 0
label=1,--timelabel 1 or 0
ly=10,--label coordinates
lx=10,--label coordinates
})
-- ###########################################################################
· ↓ ↓ ↓ ↓ ↓ ↓ ·
BunsenLabs Forums now Open for Registration
· ↑ ↑ ↑ ↑ ↑ ↑ · BL ModSquad
Offline
^ that should do it
i was about to post something very similar
Offline
iweather_falldown.lua starts like:
-- put it right at the top, before the template code starts ------------------ -- start daytime function daytime(sr,ss)
Not here, it doesn't. Mine actually starts with...
-- ## DISPLAY FUNCTION ######## DISPLAY FUNCTION ######## DISPLAY FUNCTION ###
_G.weather_script = function(update,time,now,text_forecast,day,hour)
What I'd suggest for versioning? Seems prudent "now".
I should download the "current version" but I have a number of edits I'd like to keep, so that gives me pause. <pause>
I'll give it a go on a new "current version" tomorrow.
Thanks!
Success is 1% Inspiration
and 98% Perspiration and
2% atttention to details.
Offline
here is a different template with the map running
getmap=1--fetches map on startup and template resave
--DISPLAY FUNCTION--DISPLAY FUNCTION--DISPLAY FUNCTION--DISPLAY FUNCTION-
_G.weather_script = function(update,time,now,text_forecast,day,hour,alerts)--#### DO NOT EDIT THIS LINE ##############
--#######################################################################
--these tables hold the coordinates for each repeat do not edit #########
top_left_xcoordinate={}--################################################
top_left_ycoordinate={}--################################################
--#######################################################################
--SET DEFAULTS ##########################################################
--set defaults do not localise these defaults if you use a seperate display script
default_font="Droid Sans Mono"--font must be in quotes
default_font_size=12
default_face="normal"
default_color=0xffffff--0xDCDCDC--white
default_alpha=1--fully opaque
default_image_width=60
default_image_height=60
default_weather_icons="/home/mcdowall/wun/additional_files/weathericons/icons_merlinthered_flat_colorful/"
--END OF DEFAULTS #########################################################
--image({x=0,y=0,h=150,w=150,file="/home/mcdowall/Desktop/test.png"})
--draw_background
cairo_rectangle(cr,0,0,300,250)
cairo_set_source_rgba (cr,0,0,0,0.4)
cairo_fill (cr)
image({x=0,y=0,h=90,w=90,file=now.weather_icon})
draw_moon({size=40,x=150,y=85,moon_icon=0,a=0.75,c=0xffffff,bga=1})--size,x,y,d,moon_icon,alpha,c
out({x=160,y=50,fs=44,txt=now.temp_imperial..now.temp_imperial_unit})
out({x=10,y=130,fs=18,txt=string.lower(now.location_full..", "..now.location_country)})
out({x=10,y=150,fs=14,txt=string.lower(now.conditions)})
out({x=10,y=165,fs=14,txt=string.lower(now.wind_imperial..now.wind_imperial_unit.." "..now.wind_dir)})
--set colum width
local column_width=100
local startx=0
local ypos=180
--rcolumn 1
top_left_xcoordinate[1]=startx+(0*column_width)
top_left_ycoordinate[1]=ypos
--column 2
top_left_xcoordinate[2]=startx+(1*column_width)
top_left_ycoordinate[2]=ypos
--column 3
top_left_xcoordinate[3]=startx+(2*column_width)
top_left_ycoordinate[3]=ypos
local start_number=2
local end_number=4
--########################################################################################
for i=start_number,end_number do --start of day repeat, do not edit ######################
tlx=top_left_xcoordinate[i-(start_number-1)] --sets top left x position for each repeat ##
tly=top_left_ycoordinate[i-(start_number-1)] --sets top left y position for each repeat ##
--########################################################################################
--WRITE REPEAT CODE HERE ### use i in the square brackets within the loop [i] ############
image({x=tlx+40,y=tly,h=50,w=50,file=day[i].weather_icon})
out({x=tlx+10,y=tly+60,fs=14,txt=string.lower(day[i].weekday_short)})
out({c=0xFF8C00,fs=14,x=tlx+10,y=tly+20,txt=day[i].high_imperial..day[i].high_imperial_unit})
out({c=0x00BFFF,fs=14,x=tlx+10,y=tly+40,txt=day[i].low_imperial..day[i].low_imperial_unit})
--out({x=tlx+10,y=tly+80,fs=8,txt=string.lower(day[i].conditions)})
--END OF REPEAT CODE######################################################################
end--of loop##############################################################################
--MAP SETUP
weathermap({
update=60,--update interval in conky cycles
x=0,--map coordinates
y=270,--map coordinates
apikey="yourkey",--yourapikey, using this function is an additional use of the api key
dloc=pathtowun.."weathermap/",--download location
lon=now.location_longitude,--longitude
lat=now.location_latitude,--latitude
rad=25,--radius of map data
w=300,--width of map
h=200,--height of map
unit="km",--units, "km" or "nm" (nautical miles)
stype="sat_vis",--satellite map type "sat_ir4" or "sat_vis"
gtt=107,--0 - 255 Ground temperature threshhold. Level to cutoff and leave transparent. 107 is a reasonable value to show clouds but hide land.
sborder=1,--border, 1 or 0
smooth=1,--smooth colors 1 or 0
project="ll",--"ll" or "me" Lat/lon projection or Mercator projection
basemap=1,--show basemap, 1 or 0
rainsnow=1,--rain and snow different 1, or 0
noclutter=1,--1 or 0
label=1,--timelabel 1 or 0
ly=15,--label coordinates
lx=5,--label coordinates
})
--########################################################################################
--END OF WEATHER CODE ----END OF WEATHER CODE ----END OF WEATHER CODE ---
--########################################################################################
end--of weather_display function do not edit this line ##################
--#######################################################################
function weathermap(mapt)
local mapx=mapt.x or 0
local mapy=mapt.y or 0
local mykey=mapt.apikey
local dloc=mapt.dloc or pathtowun.."weathermap/"
local fname="weathermap"
local lon=mapt.lon or now.location_longitude
local lat=mapt.lat or now.location_latitude
local irad=mapt.rad or 200
local iwid=mapt.w or 400
local ihig=mapt.h or 200
--satellite stuff first
local srdu=mapt.unit or "km"
local satt=mapt.stype or "sat_vis"
local gtt=mapt.gtt or 107
local bmap=0
local sbrd=mapt.sborder or 1
local smth=mapt.smooth or 1
local proj=mapt.project or "ll"
local tmlbs=0
local tmlbsy=0
local tmlbsx=0
--radar stuff
local tmlbr=mapt.label or 1
local tmlbry=mapt.ly or 10
local tmlbrx=mapt.lx or 10
local nmap=mapt.basemap or 1
local rnsn=mapt.rainsnow or 1
local nocl=mapt.noclutter or 1
local update=mapt.update or 60
--timer #################################
local updates=tonumber(conky_parse('${updates}'))
local timer=(updates %tonumber(update))
--#######################################
if getmap==1 or timer==0 then
print ("updating map")
local f=io.popen("ls "..dloc)
for l in f:lines() do
os.remove(dloc..l)
end
f:close()
timestamp=tostring(os.date("%d%H%M%S"))
local dloc=dloc..fname..timestamp..".gif"
local saturl="http://api.wunderground.com/api/"..mykey.."//radar/satellite/image.gif?rad.centerlat="..lat.."&rad.centerlon="..lon.."&sat.centerlat="..lat.."&sat.centerlon="..lon.."&rad.radius="..irad.."&rad.width="..iwid.."&rad.height="..ihig.."&sat.radius="..irad.."&sat.width="..iwid.."&sat.height="..ihig.."&sat.radunits="..srdu.."&sat.key="..satt.."&sat.gtt="..gtt.."&sat.basemap="..bmap.."&sat.borders="..sbrd.."&sat.smooth="..smth.."&sat.proj="..proj.."&sat.timelabel="..tmlbs.."&sat.timelabel.x="..tmlbsx.."&sat.timelabel.y="..tmlbsy.."&rad.radunits="..srdu.."&rad.newmaps="..nmap.."&rad.rainsnow="..rnsn.."&rad.smooth="..smth.."&rad.proj="..proj.."&rad.timelabel="..tmlbr.."&rad.timelabel.x="..tmlbrx.."&rad.timelabel.y="..tmlbry.."&rad.noclutter="..nocl..""
local f=io.popen("wget -q -O "..dloc.." '"..saturl.."'")
f:close()
end--if getmap
getmap=nil
image({x=mapx,y=mapy,w=iwid,h=ihig,file=dloc..fname..timestamp..".gif"})
end--map function
as for keeping customized scripts, you could take them out of wun, then update, or make a new folder for your custom scripts that wont get overwritten
Last edited by mrpeachy (2014-02-14 00:07:28)
Offline
I believe and this is imho.
The map script just like the alerts script would be very difficult to incorporate within falldown's template.
Above (probably the best option) or below yes but embedded in???
I could be wrong, like I said imho.
A person who has a cat by the tail knows a whole lot more about cats than someone who has just read about them.
Mark Twain
Offline
maybe i could take a look at the iweather scripts, and see if i can streamline them a little
make it easier to see what is what and to add additional bits and pieces
Offline
^ You could! 8) ]:D
I'd just screw things up.
Last edited by jst_joe (2014-02-14 00:48:24)
A person who has a cat by the tail knows a whole lot more about cats than someone who has just read about them.
Mark Twain
Offline
here is my map working along with some prototype graphs, red one is temp for next 36 hours, green one is dew
http://s23.postimg.org/ao6dkxnzr/Screenshot_from_2014_02_13_14_10_44.jpg
this graphs look very promising! i really hope to see the final version
Offline
^ You could! 8) ]:D
I'd just screw things up.![]()
![]()
Imagine what I'd do ...
... what's this piece? O:)
Donno! doesn't look important... ]:D
hmmmm ... O:) toss it! ]:D
Last edited by Sector11 (2014-02-14 17:16:31)
· ↓ ↓ ↓ ↓ ↓ ↓ ·
BunsenLabs Forums now Open for Registration
· ↑ ↑ ↑ ↑ ↑ ↑ · BL ModSquad
Offline
Imagine what I'd do ...
I've seen some pretty impressive work come from your direction.
A person who has a cat by the tail knows a whole lot more about cats than someone who has just read about them.
Mark Twain
Offline
Sector11 wrote:
Imagine what I'd do ...
I've seen some pretty impressive work come from your direction.
Yea, I know ... but I just bend fold and mutilate lua scripts ... mrpeachy builds them
· ↓ ↓ ↓ ↓ ↓ ↓ ·
BunsenLabs Forums now Open for Registration
· ↑ ↑ ↑ ↑ ↑ ↑ · BL ModSquad
Offline
Yea, I know ... but I just bend fold and mutilate lua scripts ... mrpeachy builds them
I resemble that remark.
A person who has a cat by the tail knows a whole lot more about cats than someone who has just read about them.
Mark Twain
Offline
ive added the graph function and the map function to the additional_functions.lua file
details here
http://crunchbang.org/forums/viewtopic. … 41#p354941
the map and graphs still need some work but they should be functional
Offline
oops forgot a rather important bit of info for getting the weathergraph working
updated in the link above, also a fix in the code, so grab additional_functions.lua
Offline
I have an idea for the map. 8o
I think it'll work, I saw it in a cartoon once.
I'll post scrots in the next day or two if it does...
if it doesn't then I blew my puter up and/or WU banned me permanently. ]:D
A person who has a cat by the tail knows a whole lot more about cats than someone who has just read about them.
Mark Twain
Offline
updated the weathermaps additional function as there were problems with the combined map
so i split out the radar from the satellite map
each map uses 1 api call so be careful!
updated info and script here
http://crunchbang.org/forums/viewtopic. … 41#p354941
next on my list of things to do is to find a key for the colors
Last edited by mrpeachy (2014-02-15 18:52:34)
Offline
Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.
Server: acrobat