Wttr.in: Add option for smaller output (for 80x24)

Created on 30 Sep 2017  Â·  33Comments  Â·  Source: chubin/wttr.in

It would be nice to have an option to get a more compact output (eg. with icon only for the current weather)

This is what it looks like on a 80x24 screen:

screenshot_20170930_175203

work-started

Most helpful comment

I think a compact output option would be great! I am imagining something like this:

Weather report: Toronto, Canada

    \  /       Partly cloudy
  _ /"".-.     -4-2 °C        
    \_(   ).   ↓ 35 km/h      
    /(___(__)  24 km          
               0.0 mm         
Thu
Morning  -8  -4  Cloudy         
Noon     -4   0  Cloudy         
Evening  -3   1  Partly cloudy  
Night    -5  -1  Partly cloudy  

Fri
Morning  -6  -2  Cloudy         
Noon     -2   1  Partly cloudy  
Evening  -1   2  Partly cloudy  
Night    -5  -1  Partly cloudy  

Sat
Morning  -7  -3  Sunny  
Noon     -3   0  Sunny  
Evening  -1   2  Sunny  
Night    -5  -1  Clear 

Is this format similar to what you had in mind @MightyPork @chubin?

For now, I just use a short python script which creates this summary by reformatting stdout from wttr.in (without colors, ?T). It is not very flexible since it depends on the specific position of the lines, but it works for me at the moment, so I just wanted to include it in case someone find it helpful. Ideally it should be possible to choose which columns are displayed, and of course not just reformat stdout, but actually use the input data and present it in an alternative layout.

All 33 comments

Yes, you are right, but as a temporary workaround you can use ?2n:

curl wttr.in/Prague?2n

good tip, that almost fits my screen (except the current weather icon and the last line). 1n wouldn't be much of a forecast, but fits well :)
screenshot_20170930_184047

Try this:

curl -s wttr.in/Prague?2nQ | head -n -3 | grep -v ┼

It exactly fits the screen (80x25)

it's perfect ;)

I would say it is a perfect workaround, but what would be really perfect, if we could get 4x4 weather table that fits 80x25 screen and could be activated with a single option

@chubin, you may be interested in this:
curl wttr.in | less -S
This way the long lines are truncated and the text can be moved using the arrows keys.

I know about less, but similar to grep, ultimately I can't use it, because
the place I wanted to run this doesn't have any OS on it, just an
equivalent of curl. If it could be an extra flag, that would be ideal - for
now, if course, the solution is to do those text transforms in C before
displaying it

On Oct 5, 2017 1:20 AM, "Agustin Ferrari" notifications@github.com wrote:

@chubin https://github.com/chubin, you may be interested in this:
curl wttr.in | less -S
This way the long lines are truncated and the text can be moved using the
arrows keys.

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/chubin/wttr.in/issues/151#issuecomment-334316903, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AB8lHsti7oaIcvYA8x8jGDoqrYYt4k8sks5spBKmgaJpZM4PpmYM
.

I'm currently porting wttr.in to an embedded platform which have a 80*68 terminal but does no binutils.
Since it does not rely on Curl but on a custom HTTP client, It can provide a specific useragent if needed.
A custom GET param would also be fine by me.

@yne Just specify curl as user-agent. Regarding 80x68 version, have you tried ?3n already?

curl wttr.in/?3n

Does it work for you?

@chubin
Yeah, I found a way to tweak the font in order to get a narrow output (while keeping the Morning/Noon/Evening/Night).
https://github.com/vitasdk/samples/pull/38
So now wttr.in work on the PSvita.

@yne: That's really cool!!! Could you please a photo of it and post it here?

@chubin

Photo:

Screencap:

Sorry for derailing this thread

@yne Thank you very much! Overcast looks strange. Do you know why?

no Idea, maybe one of the CSI code was misunderstood, I'll investigate later :)

@yne Have you tried rate.sx by the way already? Maybe you don't need this info on PSvita, but it anyway cool (and I'm curious, if the sparks will be displayed correclty). (I noted that some unicode characters are displayed wrong on your shot)

The PSVita does not have any "terminal emulator" (because it's a game console, and because debug are supposed to be send to the development host machine).
So in order to "printf" to the screen we have to do the pixel drawing ourselves.
And the font table used is only made of 256 characters:
out
So I do the unicode->256char_table conversion myself (this is why some cyrilic character cannot be printed)

About rate.sx:
It print a lots of 'q':
out
and curl | hd seems to show that this is related to a strange kind of escape

00000450  42 54 43 20 44 6f 6d 69  6e 61 6e 63 65 3a 20 36  |BTC Dominance: 6|
00000460  33 2e 37 25 20 1b 5b 32  6d 3d 1b 5b 30 6d 0a 1b  |3.7% .[2m=.[0m..|
00000470  28 30 1b 5b 32 6d 6c 71  71 71 71 71 71 77 71 71  |(0.[2mlqqqqqqwqq|

why didn't you reuse the same box drawing than wttr.in ?

we're getting a bit derailed here, but I can help explain what's going on there.
rate.sx is using alternate character sets (which is a standard vt100 feature), looks like your terminal doesn't have support yet.

This page https://www.in-ulm.de/~mascheck/various/alternate_charset/ has some explanation, it's a little confusing.

ESC(0 switches to codepage 0, which is:

screenshot_20171207_173143

The normal codepage is "B".

Some more details - https://espterm.github.io/help.html - if you open the Alternate Character Sets section - note that pages 1, 2 and 3 listed there are not standard.

@MightyPork Thanks for clearing that up, and for your patience.
I've opened an issue https://github.com/chubin/rate.sx/issues/3 to ask for a unified unicode usage across all @chubin applications.
I'll continue the discussion about rate.cx+PSVita on this new Issue (since wttr.in now work)

I think a compact output option would be great! I am imagining something like this:

Weather report: Toronto, Canada

    \  /       Partly cloudy
  _ /"".-.     -4-2 °C        
    \_(   ).   ↓ 35 km/h      
    /(___(__)  24 km          
               0.0 mm         
Thu
Morning  -8  -4  Cloudy         
Noon     -4   0  Cloudy         
Evening  -3   1  Partly cloudy  
Night    -5  -1  Partly cloudy  

Fri
Morning  -6  -2  Cloudy         
Noon     -2   1  Partly cloudy  
Evening  -1   2  Partly cloudy  
Night    -5  -1  Partly cloudy  

Sat
Morning  -7  -3  Sunny  
Noon     -3   0  Sunny  
Evening  -1   2  Sunny  
Night    -5  -1  Clear 

Is this format similar to what you had in mind @MightyPork @chubin?

For now, I just use a short python script which creates this summary by reformatting stdout from wttr.in (without colors, ?T). It is not very flexible since it depends on the specific position of the lines, but it works for me at the moment, so I just wanted to include it in case someone find it helpful. Ideally it should be possible to choose which columns are displayed, and of course not just reformat stdout, but actually use the input data and present it in an alternative layout.

Not sure if what @joelostblom asked for is being worked on/done. But I vote for that.

Third this, this is exactly what I was looking for. I used your script @joelostblom but had to sub out "-" for ".." which they apparent did at some point.

@kyprifog At what place have you substituted - with ..? At the picture at the top?

I was referring to the python parsing script. It was assuming dates ranges were with - but they were with ...

@kyprifog Ah, ok; I think we shoult adopt the output format as the script, and make it available at t1.wttr.in (aka wttr.in/?format=t1)

Just jumping in to say I also want this feature. I want to use wttr on small embedded displays that might only be 70x25 or something like that.

@nickajeglin Sure! Have you seen v2.wttr.in by the way? What do you think about it?

V2 is awesome! I am kind of obsessed with meteograms. I have a widget on my phone right now that grabs a custom image from NOAA every 4 hours. It's apparently a php backend and you can pull charts for lots of different weather variables and locations just by changing the arguments:

https://preview.tinyurl.com/ycbb94zv

(Sorry for the tinyurl, GitHub wouldn't let me link the original huge one)

Wow, it is a cool meteogram; we need something like this in the console!

Maybe I should open a separate issue for this request, but it goes sort of along with this. The "n" option outputs noon and night. Can we get a similar option to get any 3 divisions? I'm looking for the ability to select morning-noon-night or morning-noon-evening

@nickajeglin It's a good idea, something like columns=mde (m for morning, d for day, e for evening)

w3m could be workaround in terminal, since it can scroll contents. But it fails to show colors (despite receiving html) and png - only basic format and only mono. There could be URL options for expected window size.
Also some more ways to reduce size:

  • no vertical spliters - just 1..3 spaces between columns and up to 0 spaces between column and frame (edit again: could be separate options for vertical separators and spacing).
  • joined vertical box, with date headers placed at separators.
  • column names could be just bold, also with header separator removed.
    Btw... since I'm about style, how about rounded corners :) (sure if fonts have weather emoji, they would have these candy as well).

Edit: With options for output size some above options could be tuned dynamically (at least try to fit).

actually, w3m works currently, but it can't handle ANSI, and uses HTML as input.

The real solution would be to pass the terminal width automatically to the server
(it is the $COLUMNS variable basically), but this feature needs support at the client side
(or should be passed explicitly). Anyway, it is not yet supported on the server side.

I think, we have a lot of different options and opinions, how exactly the narrow view should
look like, so the best way to go here would be probably to create a flexible post-processing
mechanism that could allow to select the view on the fly (similarly to that what we have,
for the major views selection: v1, v2, v3, and subviews v1t and v1d for the nerd fonts views).

Related issues:

65

113

192

197

297

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sleeperzjf picture sleeperzjf  Â·  7Comments

argestes picture argestes  Â·  6Comments

dessalines picture dessalines  Â·  7Comments

natehouk picture natehouk  Â·  4Comments

arkylin picture arkylin  Â·  9Comments