Animation of a year of Global Cloud Cover

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. )

Export Google Fit Daily Steps, Weight and Distance to a Google Sheet

Updated on Friday, December 29, 2023

Google Fit Daily Step Export

Google Fit is a great way to keep track of your daily step count without needing to carry a Fitbit or other dedicated tracker. It's not easy to get that data out though, as far as I can tell the only way is Google Takeout which is not made for automation. Luckily there is an API and you can do almost anything with Google Sheets.

If you're looking to export your step count, weight and distance this post has everything you need, just follow the instructions below to get your spreadsheet up and running. This is also a good primer on using OAuth2 with Google Apps Script and should be a decent starting point for a more complex Google Fit integration. If you have any questions or feedback please leave a comment below.

To get started you need a Google Sheet, an apps script project attached to the sheet and a Google API Project that will provide access to the Fitness API. That might sound intimidating but it should only take a few minutes to get everything up and running.

In Google Drive create a new spreadsheet and call it whatever you like. Rename the first tab to 'Metrics'. Enter 'Date' in cell A1, 'Steps' in B1, 'Weight' in C1 and 'Distance' in D1. To grab history as well create another tab called 'History' with the same headers. Next select 'Script editor...' from the Tools menu which will open a new apps script project.

Give the apps script project a name and then select 'Libraries...' from the Resources menu. Next to 'Add a library' enter 1B7FSrk5Zi6L1rSxxTDgDEUsPzlukDsi4KGuTMorsTQHhGBzBkMun4iDF and click Add. This will find the Google OAuth2 library. Choose the most recent version (24 at the time of writing) and click Save. Then select 'Project properties' from the File menu and make a note of the Script ID (a long series of letters and numbers).

Open the Google API Console. Create a new project and name it something like 'Google Fit Sheet'. From the Dashboard click Enabled APIs and services and find and select the Fitness API. Then go to Credentials and create an OAuth Client ID. You'll be asked to create a consent screen, the only field you need to enter is the product name (i.e. 'My Fit App'). Then choose Web Application as the application type. You need to set the name and the authorized redirect URL. The redirect URL is https://script.google.com/macros/d/{SCRIPTID}/usercallback replacing {SCRIPTID} with the actual Script ID you made a note of above. After adding this make a note of the Client ID and Client Secret.

Go back to the apps script project and paste the code below into the Code.gs window:

Right at the top of the code there are spaces to enter the Client ID and Client Secret from the API Console. Enter these and save the project.

Switch back to your Google Sheet and reload. After reloading there will be a Google Fit menu item. First select Authorize... You'll get a screen to authorize the script and then a sidebar with a link. Click the link to authorize the script to access your Google Fit data. You can then close the sidebar and select Get Metrics for Yesterday from the Google Fit menu. You should see a new row added to the spreadsheet with yesterday's date and fitness data.

The final step is to automate pulling in the data. Go back to the apps script project and select Current project's triggers from the Edit menu. Add a trigger to run getMetrics() as a time driven day timer - I recommend between 5 and 6am. You can also click notifications to add an email alert if anything goes wrong, like your Google Fit authorization expiring (in which case you just need to come back and authorize from the Google Fit menu again.

At this point you're all set. Every day the spreadsheet will automatically update with your step count from the day before. You can add charts, moving averages, export to other systems, pull in your weight or BMI, etc. I want to add a seven day moving average step count to this blog somewhere as a semi-public motivational tool... watch this space.

Note that weight will be blank in the spreadsheet for days with no weight data. Google Fit doesn't return the last known weight, only the known value for days where an update was recorded.

If you are looking to extend this sample to other data types then this API explorer page is very helpful for finding data types that the API documentation doesn't list.

A couple of times working on this script I got my authorization in a bad state and started getting a 400 error response from the API. If this happens run your Google Fit app, click the Profile icon at the bottom and then the Settings icon at the top right. Click Manage connected apps and then disconnect the script from Google Fit. Finally run the Reset Settings option from the menu in the sheet and then authorize again.

I updated this post on Jan 21, 2019 to extend the sample to handle weight and distance as well as steps. I also improved the history function to handle many days in one API call rather than a quick hack I added earlier that pulled a day at a time. I'd recommend using the code above rather than anything included in comments below (at least comments before this update).

Add your comment...

More Google Apps Script Projects

(All Code Posts)

(Published to the Fediverse as: Export Google Fit Daily Steps, Weight and Distance to a Google Sheet #code #software #fit #appsscript #google #sheets #drive Detailed instructions for setting up an automatic daily export of your step count from Google Fit to a Google Sheet. Uses Google Sheets, Apps Script and the Google Fitness API. )

Enable GZIP compression for Amazon S3 hosted website in CloudFront

Updated on Tuesday, November 12, 2019

Enable GZIP compression for Amazon S3 hosted website in CloudFront

By default compression doesn't work in CloudFront for a website backed by an Amaxon S3 bucket.

The first step is pretty obvious - switch on compression in CloudFront:

Compress Objects Automatically option in Amazon CloudFront

To get to this setting open you distribution, go to the Behaviors tab and edit your behavior(s). Scroll down to the bottom and toggle Compress Objects Automatically to On. Save and drum your fingers while the distribution updates.

The less obvious piece is that CloudFront will only compress files between 1,000 and 10,000,000 bytes (as of writing this post) and it detects the filesize from the Content-Length header. What the documentation doesn't mention is that S3 does not send the Content-Length header by default and so no compression is applied.

Go to S3 and open the properties for your bucket (not for individual files). Expand Permissions and then click Edit CORS Configuration. You need to add Content-Length as an allowed header like this:

Amazon S3 CORS Configuration

Add your comment...

Related Posts

(All Code Posts)

(Published to the Fediverse as: Enable GZIP compression for Amazon S3 hosted website in CloudFront #code #software #s3 #cloudfront #aws How to configure Amazon CloudFront to apply gzip compression for websites hosted using Amazon S3 (Simple Storage Service) )

Catfood Software Support

Updated on Sunday, December 18, 2022

Catfood Software Support

Need help with a Catfood Software product? Please leave a comment below.

Add your comment...

Related Posts

(All Code Posts)

(Published to the Fediverse as: Catfood Software Support #code #software #support #earth #webcamsaver #pdfscan #fortune #weather #mail #nosleep #camsaver #ftp #cookies The fastest way to get support for Catfood Software is to leave a comment on this post. Includes Catfood Earth and WebCamSaver. )

Catfood Earth 3.41

Updated on Monday, May 31, 2021

Catfood Earth 3.41

Catfood Earth 3.41 fixes a problem that was preventing the weather radar layer from loading.

I've also updated to the latest (2015g) time zone database and the latest time zone map from Eric Muller.

Download the latest Catfood Earth.

(Previously)

Add your comment...

Related Posts

(All Code Posts)

Catfood Earth 3.40

Updated on Monday, May 31, 2021

Catfood Earth 3.40

I've just released Catfood Earth 3.40 for Windows and 1.50 for Android.

Both updates fix a problem with the clouds layer not updating. The Android update also adds compatibility for Android 5 / Lollipop.

Also, Catfood Earth for Android is now free. I had been charging $0.99 for the Android version but I've reached the conclusion that I'm never going to retire based on this (or even buy more than a couple of beers) so it's not worth the hassle. Catfood Earth for Windows has been free since 3.20.

Enjoy!

Add your comment...

Related Posts

(All Code Posts)

Fortune Cookies for Android

Updated on Thursday, November 12, 2015

Fortune Cookies for Android

Fortune is now available on Google Play. It's an Android version of the UNIX fortune program and will send a random fortune cookie to your notification area at 8ish every morning.

Add your comment...

Related Posts

(All Code Posts)

(Published to the Fediverse as: Fortune Cookies for Android #code #fortune #software Fortune Cookies, the UNIX classic, is now available for Android. )

ZoneInfo Update (tzdata for .NET)

Updated on Wednesday, June 2, 2021

ZoneInfo Update (tzdata for .NET)

I've used the ZoneInfo (PublicDomain.ZoneInfo) project from CodePlex for quite a few years, especially in Catfood Earth. The project had rusted a little so I emailed the author (Mark Rodrigues) and he was kind enough to add me as a developer. I've just updated ZoneInfo with some of the local changes I'd made and a variety of patches from the CodePlex community. It now works with the latest IANA tzdata file, at least for the test cases I can run. Let me know if I missed something (and thanks Mark for letting me contribute back to this very helpful project).

Add your comment...

Related Posts

(All Code Posts)

(Published to the Fediverse as: ZoneInfo Update (tzdata for .NET) #code #software #earth #zoneinfo #codeplex ZoneInfo - updated library to access the IANA time zone database (tzdata) from .NET projects. )

Thank you Feedly

Updated on Friday, May 22, 2020

Thank you Feedly

It has been brought to my attention that I've been whinging too much recently

So I'd like to take a break from that and say how much I'm enjoying feedly. It's a wonderfully well designed RSS reader. I use the Chrome Extension version and the Android app. It preserves the Google Reader keyboard shortcuts so I can sail through my subscriptions and it brings back social sharing. 

I looked at feedly once before and didn't really get it. I thought it was just one of those algorithmic recommendation news manglers that tries to guess what you want to read. It might do that on the home page but the 'All' view is a perfect replacement for Google Reader. 

I love it. I want to pay for it to make sure it stays around. Thank you feedly. 

Add your comment...

Related Posts

(All Marketing Posts)

(Published to the Fediverse as: Thank you Feedly #marketing #feedly #software Feedly is an awesome RSS reader and the ideal replacement for Google Reader for RSS fans. )

Reviews and Links for August 2012

Updated on Friday, February 24, 2017

The Last Policeman by Ben H. Winters

5/5

Stonking police procedural set in the months leading up to a global catastrophe.

 

Kill Decision by Daniel Suarez

5/5

Excellent techno-thriller. A little more serious and focused than Daemon and Freedom (TM). It's about a worst case drone scenario, ants, extra-special forces and some smart birds. Very good.

 

Links

Windows 8, Users 0? http://t.co/966Cuwjz

Bill Nye declares Todd Akin "fucking idiot"; issues debate challenge http://t.co/AZ3k55Y4 #fb

ITHCWY: Fight Facebook with Email: I was a little saddened to read today that Diaspora is transitioning over to… http://t.co/2G0pDdu0

Diaspora Founders To Move On, Handing Over Decentralized Social Network ‘To The Community’ http://t.co/KQGb2kpv -- sad, but not the future

RT @MargaretAtwood: Just used http://t.co/Nhna2CGO for gruesome printer problem: excellent, done in 10 mins! Tks to S H E F I N. Website ...

Check out Catfood Earth Live Wallpaper on Google Play! https://t.co/NTJQ1sYL

ITHCWY: Twenty-Four Hours with Twilio: I've wanted to play with Twilio's voice and SMS service for a while and… http://t.co/KOK0PG2M

Tuesdays http://t.co/BLNiCP3H

Twitter Cuts Off Tumblr's Ability to Find Friends http://t.co/1g3ZcClf

5 of 5 stars to The Last Policeman by Ben H. Winters http://t.co/9NF2nviH

XML: http://t.co/VadVt321 #rofl

Windows 8 Is Now Available For Developers (And For Everybody Else, There’s A 90-Day Free Trial, Too) http://t.co/iu1li6BV

Gotye's YouTube orchestra remix of "Somebody That I Used to Know" http://t.co/OUEXXltQ

ITHCWY: City by the Bay: View from Bernal Hill this afternoon. http://t.co/11cI3ctk

Nice panorama! Curiosity rover: Martian solar day 2 #360pano http://t.co/w1H2ocUm via @360cities

ITHCWY: Share a picture in MonoDroid: Here’s how to share a picture to Facebook, Twitter and so forth from… http://t.co/pByzvjmx

5 of 5 stars to Kill Decision by Daniel Suarez http://t.co/TKgUMNW0

BBC News - Mars rover makes first colour panorama http://t.co/fZ7u8smZ

How Apple and Amazon Security Flaws Led to My Epic Hacking http://t.co/BDmRAbm3

Via KQED Guides: Guide to Bay Area Tidepools: Where to Explore Amazing Marine Life | http://t.co/TDBRDnTD #todo @myEN

ITHCWY: Catfood: WebCams for Android: I’ve just released a WebCam app for Android. It’s based on WebCamSaver but… http://t.co/azZUwkkz

Pay for a new social network with no ads? https://t.co/2tox3c2y Anyone I know going to be on there? #fb

Curiosity http://t.co/D2cyWE66

BBC News - Photo shows Mars rover descent http://t.co/KfOv1qOF

Catfood WebCams for Android - Catfood Software http://t.co/VzeySq90 via @CatfoodSoftware

Check out Catfood WebCams on Google Play! https://t.co/VTU8YiBd

ITHCWY: Not a Private Key: When jarsigner says "Key Associated with [alias] not a private key" it almost certainly… http://t.co/3sk89ENV

ITHCWY: Sending email via GMail in C#/.NET using SmtpClient: I’ve stubbed my toe on this a couple of times, so here… http://t.co/QJ7YjcjI

Help end patent litigation insanity and tell your congress person to back SHIELD. http://t.co/27anadBt

ITHCWY: Support SHIELD–a small measure of patent sanity: A friend pointed me at the SHIELD (PDF) act today. This… http://t.co/ArXHgZ0e

ITHCWY: Thank you for choosing HSA Bank!: No, thank you HSA Bank for not giving me a choice and then cheekily… http://t.co/9torSXCq

Bill would force patent trolls to pay defendants’ legal bills | Ars Technica http://t.co/poB3zzlX +1, via @sr00t

What a happy coincidence. As well as #IPAday it's also goof off at work day: http://t.co/7AItItWq

Apparently it's #IPADay - luckily there's some @21stAmendment in the fridge. http://t.co/jyYPSePC

Add your comment...

Related Posts

(All Reviews)