Catfood Earth 3.46

By Robert Ellison. Updated on Monday, May 31, 2021.

Improved clouds in Catfood Earth

Catfood Earth 3.46 is now available for download. Catfood Earth for Android 1.70 is available in the Google Play Store and will update automatically if you already have it installed.

This follows hot on the heels of the last release as the new clouds layer service running on this blog can update far more frequently than the source used prior to 3.45. You will now get a fresh helping of clouds every hour! Unrelated to this release I've improved the quality of the clouds image as well. If you're interested you can read about this in exhaustive detail here.

Add your comment...

Related Posts

(All Code Posts)

Improving the accuracy of the new Catfood Earth clouds layer

By Robert Ellison. Updated on Sunday, September 3, 2023.

Equirectangular clouds for Catfood Earth

Last weekend I rushed out a new version of Catfood Earth because the clouds layer stopped working. I'd been using xplanet clouds which published a free 2048x1024 image infrequently and for some reason the site has vanished (probably because it was based on data from the Dundee Satellite Receiving Station which has apparently closed). The University of Wisconsin-Madison Space Science and Engineering Center makes global cloud data available for free for non-commercial use so I plugged this in to get Catfood Earth up and running.

Clouds started working again last Saturday but they were slightly out of position. With a pixel on a HD screen being up to 13 miles this isn't ideal. I hope nobody is using Catfood Earth for weather forecasting or anything too serious but this bothered me enough that I had to fix it. From today the clouds layer is as close to perfect as I can make it.

Mostly for my own sanity in case I ever need to fix this again here's the process.

I use the globalir product because it covers both day and night. This is available in a number of resolutions and you just need to download a set of tiles and stitch them together - I'm using 4096x4096 as the source for the new layer. Catfood Earth uses equirectangular images which have a 2:1 aspect ratio so to start with I resized this less at the equator and more at the poles and got an image that was almost right.

The source image is Spherical (or Web) Mercator which is useful for Google Maps but not right for Catfood Earth. I found a Stack Exchange post which pointed me in the right direction - use GDAL (Geospatial Data Abstraction Library) to transform the Mercator image to equirectangular by tagging the corners and then warping it. This got me closer but it still wasn't right. More googling led me to a post by Robert Simmon with a gdalwarp tip to use -te and -te_srs to force the output to match the dimensions of the input.

The last problem is that the Mercator image doesn't reach all the way to the poles. In this case there is no alternative but to invent some data and so I flip the top and bottom 50 pixels to cover the gap. You can see this if you look carefully but as this region is rendered over ice in Catfood Earth it won't make a difference in practice (and the old image used this trick as well for a greater proportion of the clouds).

One final visual tweak is to drop the lowest intensity pixels which end up blurring out the background in Catfood Earth. You can adjust the transparency and color used to render the layer to suit your tastes (the default is 50% transparency and a gray color for the clouds which I think strikes a good balance).

I also increased the frequency of updates so a new image is available every hour. I said last week that an advantage of this new system was that I wouldn't need to push a new version of Catfood Earth to tweak the cloud logic. That's partly true - you'll get the new improved image with the current version, but I stepped down the update frequency to once a day when I started using xplanet clouds. There will be another update soon to the Windows and Android versions to switch to hourly updates.

Updated 2022-11-05 12:28:

A couple of updates here. The first is that RealEarth started watermarking images over a certain resolution and/or usage volume. You now need an API key and potentially to pay based on usage. More details here. I managed to stay in the free tier by asking nicely and scaling back to HD. The clouds download is still 4k but this is upscaled from a HD version.

Grabbing the latest image (for globalir) worked until sometime in October and then the tiles stopped lining up correctly. I'm not sure what changed, I guess that 'latest' used to mean the latest composite and now means the latest data for any given tile regardless of it is the same time as the others. I just fixed this to use the latest complete image (this API provides available dates and times, and then you need to use the date and time in the globalir call to get a working composite image).

Updated 2023-09-03 01:03:

There is now a video made from the last 48 hours of cloud images here, updated hourly. The video skips the step of dropping low intensity pixels so you get 100% of the cloud cover.

Add your comment...

Related Posts

(All Code Posts)

(Published to the Fediverse as: Improving the accuracy of the new Catfood Earth clouds layer #code #earth #clouds Using the Geospatial Data Abstraction Library to transform a Spherical Mercator cloud image to equirectangular for Catfood Earth. )

Catfood Earth 3.45

By Robert Ellison. Updated on Monday, May 31, 2021.

New cloud layer image in Catfood Earth

Catfood Earth 3.45 is now available to download. Catfood Earth for Android 1.60 is available on Google Play and will update automatically if you have it installed.

I only just released 3.44 with some timezone updates but in the past week the location I had been using for global cloud cover abruptly shut down. If you like up to date clouds you'll want to install the new versions as soon as possible. With this update I'm building a cloud image every three hours and serving through this blog (and thankfully CloudFlare) so any further changes should not require a code release.

Add your comment...

Related Posts

(All Code Posts)

Vernal (Spring) Equinox 2019

Catfood Earth 3.44

By Robert Ellison. Updated on Monday, May 31, 2021.

Updated timezones in Catfood Earth 3.44

Catfood Earth 3.44 is now available to download.

The timezone database has been updated to 2018i.

Eric Muller's shapefile map of timezones is no longer maintained and so Catfood Earth has switched to Evan Siroky's timezone boundary builder version.

A bug that could cause all volcanoes to be plotted at 0,0 depending on your system locale has been fixed.

Download Catfood Earth.

(Previously)

Add your comment...

Related Posts

(All Code Posts)

Winter Solstice 2018

Autumnal Equinox 2018

Better related posts with word2vec (C#)

By Robert Ellison. Updated on Tuesday, February 13, 2024.

I have been experimenting with word2vec recently. Word2vec trains a neural network to guess which word is likely to appear given the context of the surrounding words. The result is a vector representation of each word in the trained vocabulary with some amazing properties (the canonical example is king - man + woman = queen). You can also find similar words by looking at cosine distance - words that are close in meaning have vectors that are close in orientation.

This sounds like it should work well for finding related posts. Spoiler alert: it does!

My old system listed posts with similar tags. This worked reasonably well, but it depended on me remembering to add enough tags to each post and a lot of the time it really just listed a few recent posts that were loosely related. The new system (live now) does a much better job which should be helpful to visitors and is likely to help with SEO as well.

I don't have a full implementation to share as it's reasonably tightly coupled to my custom CMS but here is a code snippet which should be enough to get this up and running anywhere:

The first step is getting a vector representation of a post. Word2vec just gives you a vector for a word (or short phrase depending on how the model is trained). A related technology, doc2vec, adds the document to the vector. This could be useful but isn't really what I needed here (i.e. I could solve my forgetfulness around adding tags by training a model to suggest them for me - might be a good project for another day). I ended up using a pre-trained model and then averaging together the vectors for each word. This paper (PDF) suggests that this isn't too crazy.

For the model I used word2vec-slim which condenses the Google News model down from 3 million words to 300k. This is because my blog runs on a very modest EC2 instance and a multi-gigabyte model might kill it. I load the model into Word2vec.Tools (available via NuGet) and then just get the word vectors (GetRepresentationFor(...).NumericVector) and average them together.

I haven't included code to build the word list but I just took every word from the post, title, meta description and tag list, removed stop words (the, and, etc) and converted to lower case.

Now that each post has a vector representation it's easy to compute the most related posts. For a given post compute the cosine distance between the post vector and every other post. Sort the list in ascending order and pick however many you want from the top (the distance between the post and itself would be 1, a totally unrelated post would be 0). The last line in the code sample shows this comparison for one post pair using Accord.Math, also on Nuget.

I'm really happy with the results. This was a fast implementation and a huge improvement over tag based related posts.

Updated 2023-01-29 22:00:

I have recently moved this functionality to use an OpenAI embeddings API integration.

Add your comment...

Related Posts

(All Code Posts)

(Published to the Fediverse as: Better related posts with word2vec (C#) #code #software #word2vec #ithcwy #ml How to use word2vec to create a vector representation of a blog post and then use the cosine distance between posts to select improved related posts. )

Animation of a year of Global Cloud Cover

By Robert Ellison. Updated on Saturday, February 19, 2022.

Update April 19, 2020: I made a longer, higher resolution version which you can find here.

Animation of a year of Global Cloud Cover

Here's an animation showing a year of global cloud cover (from July 2017 to July 2018) :

The clouds are sourced from the free daily download at xplanet. I run a Google apps script that saves a copy of the image to Google Drive every day (basically the same as this script to save Nest cam images). The hard part was waiting a year to get enough frames. Xplanet combines GEOS, METEOSAT and GMS satellite imagery with some reflection near the poles. Although I didn't need to for this project note that you can subscribe to higher quality / more frequent downloads.

As well as the clouds you can also see the terminator between day and night change shape over the course of the year. This video starts and ends with the Summer equinox when days are longest in the Northern hemisphere.

Where it's nighttime the image is based on NASA's Black Marble. The daytime is based on Blue Marble, but blended with a different older image which has better ocean colors and interpolated daily between twelve monthly Blue Marble satellite images. The result of this is that you can see snow and ice coverage changing over the course of the year. If you look closely you'll also notice vegetation growing and dying back with the seasons.

Rendered in a slightly modified build of Catfood Earth (the main release doesn't know how to access my private cache of xplanet cloud images). As well as combining day, night and cloud images Catfood Earth can also show you earthquakes, volcanoes, US weather radar, political borders, places and time zones. It has been enlivening Windows desktop wallpaper for fifteen years now (as shareware back when that was a thing, these days it's a free download for Windows and Android).

Add your comment...

More Google Apps Script Projects

(All Code Posts)

(Published to the Fediverse as: Animation of a year of Global Cloud Cover #code #software #video #animation #appsscript #drive #earth #nasa #xplanet Timelapse video showing cloud cover, day and night and changing seasons. Rendered in Catfood Earth. )

Summer Solstice 2018

Summer Solstice 2018 rendered in Catfood Earth

Summer starts now in the Northern Hemisphere and the Sun is at its highest point in the sky. For those in the Southern Hemisphere I'm sorry to report that the opposite is true. Rendered in Catfood Earth.

(Previously, Previously, Previously, Previously, Previously)

Add your comment...

Related Posts

(All Code Posts)