boramalper / himawaripy

Set near-realtime picture of Earth as your desktop background
http://labs.boramalper.org/himawaripy
MIT License
1.62k stars 239 forks source link

Feature-Request: infrared #108

Open count00zero opened 4 years ago

count00zero commented 4 years ago

Hi! I recently found himawaripy and I do like it a lot ... downloading the actual image for my background and putting all the images together in a nice movie :) And that's a reason for my request: to avoid the nightly blackness I would love to use the infrared (B13) Band Pictures. Is there any chance, that you might add a configurable downloadoption for the image source (so one might choose infrared or any other available band)?

THANKS a lot and BR, count

cben commented 3 years ago

Googling some other himawari tools that support infrared, it's as simple as (would need a flag obviously):

--- himawaripy/__main__.py
+++ himawaripy/__main__.py
@@ -56,7 +56,7 @@ def download_chunk(args):
     global counter

     x, y, latest, level = args
-    url_format = "https://himawari8-dl.nict.go.jp/himawari8/img/D531106/{}d/{}/{}_{}_{}.png"
+    url_format = "https://himawari8-dl.nict.go.jp/himawari8/img/INFRARED_FULL/{}d/{}/{}_{}_{}.png"
     url = url_format.format(level, WIDTH, strftime("%Y/%m/%d/%H%M%S", latest), x, y)

But that gives an unpleasant B&W image...

Ideally I'd love a blend akin to https://www.youtube.com/watch?v=ILyO1wSBhMw, with infrared bands used to fill in the dark areas. Some explanation from a comment there:

True Color Reproduction (TCR) technology enables the display of earth images taken from space in a way that is familiar to the human eye. The imagery consists of data from three visible bands (Band 1, 2 and 3), one near-infrared band (Band 4) and one infrared band (Band 13). To reproduce colors as seen by the human eye, RGB signals observed by AHI are converted into CIE XYZ values and reconverted into RGB signals for output devices compliant with sRGB (an international standard for RGB color space) (Murata et al., 2018). In this process, as an alternative to the bi-spectral hybrid green method outlined by Miller et al. (2016), the green band is optimally adjusted using Band 2, 3 and 4. To make the imagery more vivid, atmospheric correction (Rayleigh correction, Miller et al., 2016) is also applied to AHI Bands 1-4. Software for this purpose was provided by the Cooperative Institute for Research in the Atmosphere (CIRA) established by NOAA/NESDIS and Colorado State University in United States of America.

This is probably CIRA's derived "Geocolor" data which doesn't however explain details nor where to get it.

Well, that's processing too complicated for me :grin: but to even start approaching that — e.g. combine 3 infrared bands into fake RGB, I'm failing to google a simpler question: where are the individual 16 bands available for public download?

https://himawari.asia/ lets you see each band if you choose left hamburger menu -> "Asia-Oceania 24h". Let's see... OK that page downloads urls like this: https://himawari8.nict.go.jp/img/FULL_24h/B07/1d/550/2021/07/13/161000_0_0.png where B07 is the band. And 1d is the tile zoom level (and supports tile selection via _1_2 etc.), so same URL structure :tada:

    url_format = "https://himawari8.nict.go.jp/img/FULL_24h/B13/{}d/{}/{}_{}_{}.png"

well, looks like B13 is the same as that INFRARED_FULL url.

But wait, those images are nicely greyscale, why is result pure B&W? Probably some PIL mismatch between greyscale/RGB... Printing tile variable shows:

<PIL.PngImagePlugin.PngImageFile image mode=LA size=550x550 at 0x7F8699EBD580>

and changing to Image.new("LA", ... gives a nice greyscale image :tada: OK, PR incoming...

cben commented 3 years ago

Ah, these FULL_24h/Bnn urls also work on the current himawari8-dl.nict.go.jp domain, I guess from the -dl name it's more polite to stick to it.

I'm curious how these FULL_24h images work. They always show a full disk, but they do change with times, e.g.: https://himawari8.nict.go.jp/img/FULL_24h/B07/4d/550/2021/07/13/091000_1_1.png https://himawari8.nict.go.jp/img/FULL_24h/B07/4d/550/2021/07/13/101000_1_1.png https://himawari8.nict.go.jp/img/FULL_24h/B07/4d/550/2021/07/13/111000_1_1.png but surely even in infrared bands, parts under the sun should be brighter than on the dark side!? Do they compensate for it? And what does "full 24h" mean then?

Anyway, they're pretty :earth_asia: :sparkles: