Giter VIP home page Giter VIP logo

merced-weather's Introduction

Automated Tufte-style weather graphs

Merced weather update

This repository creates the weather graph below (inspired by Edward Tufte) using R's {{ggplot2}} package. Updated data is pulled directly from NOAA's servers in CSV format. The entire process is automated using Github Actions.

This repo may be useful in three ways.

  1. replicating or adapting this graph for a different weather station
  2. learning more about data viz with ggplot2
  3. learning more about Github Actions with R

Full disclosure: Original author is John Johnson

Daily High Temperature in Merced

About this data

NOAA provides daily data for weather stations in the Global Historical Climatological Network (GHCN).

Citation:

Menne, M.J., I. Durre, B. Korzeniewski, S. McNeal, K. Thomas, X. Yin, S. Anthony, R. Ray, R.S. Vose, B.E. Gleason, and T.G. Houston, 2012: Global Historical Climatology Network - Daily (GHCN-Daily), Version 3.26. NOAA National Climatic Data Center. http://doi.org/10.7289/V5D21VHZ [February 21, 2022].

Accessing data for a different station

For every weather station in the daily GHCN, NOAA maintains a file with the station's entire daily history. Each day, they append a new record. In my observation, records are typically lagged by a few days.

Each weather station is assigned a unique indicator. The full list of station names, coordinates, and unique IDs is available here.

I use a merged file (data/GHCN_USC00045532_USW00023257.csv) that contains daily weather reports from Merced Regional Airport stations (GHCN:USC00045532 & GHCN:USW00023257). The start date is June 1, 1899.

GHCN:USC00045532
- Historical data starting from June 1, 1899

GHCN:USW00023257
- More recent up to date data starting from August 1, 1998

Refer to R/Retrieve_GHCN_USC00045532_USW00023257.R for a demonstration of downloading and processing this dataset. See NOAA's documentation for detailed descriptions of the original variable definitions.

Replicating or altering the graph

The image graphs/DailyHighTemp_USC00045532_USW00023257.png is created by R/BuidlDailyHigh.R. See the README in /graphs for a step-by-step tutorial.

Automatic Updating with Github Actions

At a high level, the automated workflow:

(1) runs the script to retrieve the updated data

(2) commits the updated dataset to the repository

(3) runs the script to build the graph

(4) commits the graph to the repository. All this takes less than 1 minute per run.

See the README in /.github/workflows for a line-by-line discussion of the workflow file.

merced-weather's People

Contributors

odavalos avatar jdjohn215 avatar actions-user avatar

merced-weather's Issues

MASS installation failing

Here is the log.

Installing MASS [7.3-54] ...
    FAILED
Error installing package 'MASS':
Error: Error: install of package 'MASS' failed [error code 1]
================================

* installing *source* package ‘MASS’ ...
** package ‘MASS’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
using C compiler: ‘gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0’
gcc -I"/usr/share/R/include" -DNDEBUG       -fpic  -g -O2 -ffile-prefix-map=/build/r-base-JhpCKt/r-base-4.3.0=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2  -c MASS.c -o MASS.o
MASS.c:37:23: error: unknown type name ‘Sint’; did you mean ‘uint’?
   37 | VR_sammon(double *dd, Sint *nn, Sint *kd, double *Y, Sint *niter,
      |                       ^~~~
      |                       uint
MASS.c:37:33: error: unknown type name ‘Sint’; did you mean ‘uint’?
   37 | VR_sammon(double *dd, Sint *nn, Sint *kd, double *Y, Sint *niter,
      |                                 ^~~~
      |                                 uint
MASS.c:37:54: error: unknown type name ‘Sint’; did you mean ‘uint’?
   37 | VR_sammon(double *dd, Sint *nn, Sint *kd, double *Y, Sint *niter,
      |                                                      ^~~~
      |                                                      uint
MASS.c:38:27: error: unknown type name ‘Sint’; did you mean ‘uint’?
   38 |           double *stress, Sint *trace, double *aa, double *tol)
      |                           ^~~~
      |                           uint
MASS.c:168:8: error: unknown type name ‘Sint’
  168 | static Sint *ord;               /* ranks of dissimilarities */
      |        ^~~~
MASS.c:169:8: error: unknown type name ‘Sint’
  169 | static Sint *ord2;              /* inverse ordering (which one is rank i?) */
      |        ^~~~
MASS.c:170:8: error: unknown type name ‘Sint’
  170 | static Sint n;                  /* number of  dissimilarities */
      |        ^~~~
MASS.c:171:8: error: unknown type name ‘Sint’
  171 | static Sint nr;                 /* number of data points */
      |        ^~~~
MASS.c:172:8: error: unknown type name ‘Sint’
  172 | static Sint nc;                 /* # cols of  fitted configuration */
      |        ^~~~
MASS.c:181:31: error: unknown type name ‘Sint’; did you mean ‘uint’?
  181 | VR_mds_fn(double *, double *, Sint *, double *, Sint *,
      |                               ^~~~
      |                               uint
MASS.c:181:49: error: unknown type name ‘Sint’; did you mean ‘uint’?
  181 | VR_mds_fn(double *, double *, Sint *, double *, Sint *,
      |                                                 ^~~~
      |                                                 uint
MASS.c:182:21: error: unknown type name ‘Sint’; did you mean ‘uint’?
  182 |           double *, Sint *, Sint *, double *, Sint *, double *);
      |                     ^~~~
      |                     uint
MASS.c:182:29: error: unknown type name ‘Sint’; did you mean ‘uint’?
  182 |           double *, Sint *, Sint *, double *, Sint *, double *);
      |                             ^~~~
      |                             uint
MASS.c:182:47: error: unknown type name ‘Sint’; did you mean ‘uint’?
  182 |           double *, Sint *, Sint *, double *, Sint *, double *);
      |                                               ^~~~
      |                                               uint
MASS.c:188:18: error: unknown type name ‘Sint’; did you mean ‘uint’?
  188 | VR_mds_init_data(Sint *pn, Sint *pc, Sint *pr, Sint *orde,
      |                  ^~~~
      |                  uint
MASS.c:188:28: error: unknown type name ‘Sint’; did you mean ‘uint’?
  188 | VR_mds_init_data(Sint *pn, Sint *pc, Sint *pr, Sint *orde,
      |                            ^~~~
      |                            uint
MASS.c:188:38: error: unknown type name ‘Sint’; did you mean ‘uint’?
  188 | VR_mds_init_data(Sint *pn, Sint *pc, Sint *pr, Sint *orde,
      |                                      ^~~~
      |                                      uint
MASS.c:188:48: error: unknown type name ‘Sint’; did you mean ‘uint’?
  188 | VR_mds_init_data(Sint *pn, Sint *pc, Sint *pr, Sint *orde,
      |                                                ^~~~
      |                                                uint
MASS.c:189:18: error: unknown type name ‘Sint’; did you mean ‘uint’?
  189 |                  Sint *ordee, double *xx, double *p)
      |                  ^~~~
      |                  uint
MASS.c: In function ‘fminfn’:
MASS.c:240:5: error: unknown type name ‘Sint’; did you mean ‘uint’?
  240 |     Sint  do_derivatives = 0;
      |     ^~~~
      |     uint
MASS.c:243:5: warning: implicit declaration of function ‘VR_mds_fn’; did you mean ‘VR_mds_unload’? [-Wimplicit-function-declaration]
  243 |     VR_mds_fn(y, yf, &n, &ssq, ord2, x, &nr, &nc, 0, &do_derivatives,
      |     ^~~~~~~~~
      |     VR_mds_unload
MASS.c: In function ‘fmingr’:
MASS.c:252:5: error: unknown type name ‘Sint’; did you mean ‘uint’?
  252 |     Sint  do_derivatives = 1;
      |     ^~~~
      |     uint
MASS.c: At top level:
MASS.c:263:26: error: unknown type name ‘Sint’; did you mean ‘uint’?
  263 | VR_mds_dovm(double *val, Sint *maxit, Sint *trace, double *xx, double *tol)
      |                          ^~~~
      |                          uint
MASS.c:263:39: error: unknown type name ‘Sint’; did you mean ‘uint’?
  263 | VR_mds_dovm(double *val, Sint *maxit, Sint *trace, double *xx, double *tol)
      |                                       ^~~~
      |                                       uint
MASS.c:280:34: error: unknown type name ‘Sint’; did you mean ‘uint’?
  280 | VR_mds_fn(double *y, double *yf, Sint *pn, double *pssq, Sint *pd,
      |                                  ^~~~
      |                                  uint
MASS.c:280:58: error: unknown type name ‘Sint’; did you mean ‘uint’?
  280 | VR_mds_fn(double *y, double *yf, Sint *pn, double *pssq, Sint *pd,
      |                                                          ^~~~
      |                                                          uint
MASS.c:281:22: error: unknown type name ‘Sint’; did you mean ‘uint’?
  281 |           double *x, Sint *pr, Sint *pncol, double *der,
      |                      ^~~~
      |                      uint
MASS.c:281:32: error: unknown type name ‘Sint’; did you mean ‘uint’?
  281 |           double *x, Sint *pr, Sint *pncol, double *der,
      |                                ^~~~
      |                                uint
MASS.c:282:11: error: unknown type name ‘Sint’; did you mean ‘uint’?
  282 |           Sint *do_derivatives, double *p)
      |           ^~~~
      |           uint
MASS.c:356:12: error: unknown type name ‘Sint’; did you mean ‘uint’?
  356 | VR_ucv_bin(Sint *n, Sint *nb, Sfloat *d, Sint *x, Sfloat *h, Sfloat *u)
      |            ^~~~
      |            uint
MASS.c:356:21: error: unknown type name ‘Sint’; did you mean ‘uint’?
  356 | VR_ucv_bin(Sint *n, Sint *nb, Sfloat *d, Sint *x, Sfloat *h, Sfloat *u)
      |                     ^~~~
      |                     uint
MASS.c:356:31: error: unknown type name ‘Sfloat’; did you mean ‘float’?
  356 | VR_ucv_bin(Sint *n, Sint *nb, Sfloat *d, Sint *x, Sfloat *h, Sfloat *u)
      |                               ^~~~~~
      |                               float
MASS.c:356:42: error: unknown type name ‘Sint’; did you mean ‘uint’?
  356 | VR_ucv_bin(Sint *n, Sint *nb, Sfloat *d, Sint *x, Sfloat *h, Sfloat *u)
      |                                          ^~~~
      |                                          uint
MASS.c:356:51: error: unknown type name ‘Sfloat’; did you mean ‘float’?
  356 | VR_ucv_bin(Sint *n, Sint *nb, Sfloat *d, Sint *x, Sfloat *h, Sfloat *u)
      |                                                   ^~~~~~
      |                                                   float
MASS.c:356:62: error: unknown type name ‘Sfloat’; did you mean ‘float’?
  356 | VR_ucv_bin(Sint *n, Sint *nb, Sfloat *d, Sint *x, Sfloat *h, Sfloat *u)
      |                                                              ^~~~~~
      |                                                              float
MASS.c:373:12: error: unknown type name ‘Sint’; did you mean ‘uint’?
  373 | VR_bcv_bin(Sint *n, Sint *nb, Sfloat *d, Sint *x, Sfloat *h, Sfloat *u)
      |            ^~~~
      |            uint
MASS.c:373:21: error: unknown type name ‘Sint’; did you mean ‘uint’?
  373 | VR_bcv_bin(Sint *n, Sint *nb, Sfloat *d, Sint *x, Sfloat *h, Sfloat *u)
      |                     ^~~~
      |                     uint
MASS.c:373:31: error: unknown type name ‘Sfloat’; did you mean ‘float’?
  373 | VR_bcv_bin(Sint *n, Sint *nb, Sfloat *d, Sint *x, Sfloat *h, Sfloat *u)
      |                               ^~~~~~
      |                               float
MASS.c:373:42: error: unknown type name ‘Sint’; did you mean ‘uint’?
  373 | VR_bcv_bin(Sint *n, Sint *nb, Sfloat *d, Sint *x, Sfloat *h, Sfloat *u)
      |                                          ^~~~
      |                                          uint
MASS.c:373:51: error: unknown type name ‘Sfloat’; did you mean ‘float’?
  373 | VR_bcv_bin(Sint *n, Sint *nb, Sfloat *d, Sint *x, Sfloat *h, Sfloat *u)
      |                                                   ^~~~~~
      |                                                   float
MASS.c:373:62: error: unknown type name ‘Sfloat’; did you mean ‘float’?
  373 | VR_bcv_bin(Sint *n, Sint *nb, Sfloat *d, Sint *x, Sfloat *h, Sfloat *u)
      |                                                              ^~~~~~
      |                                                              float
Traceback (most recent calls last):
12: renv::restore()
11: renv_restore_run_actions(project, diff, current, lockfile, rebuild)
10: renv_install_impl(records)
 9: renv_install_staged(records)
 8: renv_install_default(records)
 7: handler(package, renv_install_package(record))
 6: renv_install_package(record)
 5: withCallingHandlers(renv_install_package_impl(record), error = function(e) {
        vwritef("\tFAILED")
        writef(e$output)
    })
 4: renv_install_package_impl(record)
 3: r_cmd_install(package, path)
 2: r_exec_error(package, output, "install", status)
 1: stop(error)
Execution halted
MASS.c:391:13: error: unknown type name ‘Sint’; did you mean ‘uint’?
  391 | VR_phi4_bin(Sint *n, Sint *nb, Sfloat *d, Sint *x, Sfloat *h, Sfloat *u)
      |             ^~~~
      |             uint
MASS.c:391:22: error: unknown type name ‘Sint’; did you mean ‘uint’?
  391 | VR_phi4_bin(Sint *n, Sint *nb, Sfloat *d, Sint *x, Sfloat *h, Sfloat *u)
      |                      ^~~~
      |                      uint
MASS.c:391:32: error: unknown type name ‘Sfloat’; did you mean ‘float’?
  391 | VR_phi4_bin(Sint *n, Sint *nb, Sfloat *d, Sint *x, Sfloat *h, Sfloat *u)
      |                                ^~~~~~
      |                                float
MASS.c:391:43: error: unknown type name ‘Sint’; did you mean ‘uint’?
  391 | VR_phi4_bin(Sint *n, Sint *nb, Sfloat *d, Sint *x, Sfloat *h, Sfloat *u)
      |                                           ^~~~
      |                                           uint
MASS.c:391:52: error: unknown type name ‘Sfloat’; did you mean ‘float’?
  391 | VR_phi4_bin(Sint *n, Sint *nb, Sfloat *d, Sint *x, Sfloat *h, Sfloat *u)
      |                                                    ^~~~~~
      |                                                    float
MASS.c:391:63: error: unknown type name ‘Sfloat’; did you mean ‘float’?
  391 | VR_phi4_bin(Sint *n, Sint *nb, Sfloat *d, Sint *x, Sfloat *h, Sfloat *u)
      |                                                               ^~~~~~
      |                                                               float
MASS.c:409:13: error: unknown type name ‘Sint’; did you mean ‘uint’?
  409 | VR_phi6_bin(Sint *n, Sint *nb, Sfloat *d, Sint *x, Sfloat *h, Sfloat *u)
      |             ^~~~
      |             uint
MASS.c:409:22: error: unknown type name ‘Sint’; did you mean ‘uint’?
  409 | VR_phi6_bin(Sint *n, Sint *nb, Sfloat *d, Sint *x, Sfloat *h, Sfloat *u)
      |                      ^~~~
      |                      uint
MASS.c:409:32: error: unknown type name ‘Sfloat’; did you mean ‘float’?
  409 | VR_phi6_bin(Sint *n, Sint *nb, Sfloat *d, Sint *x, Sfloat *h, Sfloat *u)
      |                                ^~~~~~
      |                                float
MASS.c:409:43: error: unknown type name ‘Sint’; did you mean ‘uint’?
  409 | VR_phi6_bin(Sint *n, Sint *nb, Sfloat *d, Sint *x, Sfloat *h, Sfloat *u)
      |                                           ^~~~
      |                                           uint
MASS.c:409:52: error: unknown type name ‘Sfloat’; did you mean ‘float’?
  409 | VR_phi6_bin(Sint *n, Sint *nb, Sfloat *d, Sint *x, Sfloat *h, Sfloat *u)
      |                                                    ^~~~~~
      |                                                    float
MASS.c:409:63: error: unknown type name ‘Sfloat’; did you mean ‘float’?
  409 | VR_phi6_bin(Sint *n, Sint *nb, Sfloat *d, Sint *x, Sfloat *h, Sfloat *u)
      |                                                               ^~~~~~
      |                                                               float
MASS.c:428:12: error: unknown type name ‘Sint’; did you mean ‘uint’?
  428 | VR_den_bin(Sint *n, Sint *nb, Sfloat *d, Sfloat *x, Sint *cnt)
      |            ^~~~
      |            uint
MASS.c:428:21: error: unknown type name ‘Sint’; did you mean ‘uint’?
  428 | VR_den_bin(Sint *n, Sint *nb, Sfloat *d, Sfloat *x, Sint *cnt)
      |                     ^~~~
      |                     uint
MASS.c:428:31: error: unknown type name ‘Sfloat’; did you mean ‘float’?
  428 | VR_den_bin(Sint *n, Sint *nb, Sfloat *d, Sfloat *x, Sint *cnt)
      |                               ^~~~~~
      |                               float
MASS.c:428:42: error: unknown type name ‘Sfloat’; did you mean ‘float’?
  428 | VR_den_bin(Sint *n, Sint *nb, Sfloat *d, Sfloat *x, Sint *cnt)
      |                                          ^~~~~~
      |                                          float
MASS.c:428:53: error: unknown type name ‘Sint’; did you mean ‘uint’?
  428 | VR_den_bin(Sint *n, Sint *nb, Sfloat *d, Sfloat *x, Sint *cnt)
      |                                                     ^~~~
      |                                                     uint
MASS.c:466:31: error: ‘VR_bcv_bin’ undeclared here (not in a function)
  466 |     {"VR_bcv_bin", (DL_FUNC) &VR_bcv_bin, 6},
      |                               ^~~~~~~~~~
MASS.c:467:31: error: ‘VR_den_bin’ undeclared here (not in a function)
  467 |     {"VR_den_bin", (DL_FUNC) &VR_den_bin, 5},
      |                               ^~~~~~~~~~
MASS.c:468:32: error: ‘VR_mds_dovm’ undeclared here (not in a function); did you mean ‘VR_mds_unload’?
  468 |     {"VR_mds_dovm", (DL_FUNC) &VR_mds_dovm, 5},
      |                                ^~~~~~~~~~~
      |                                VR_mds_unload
MASS.c:469:30: error: ‘VR_mds_fn’ undeclared here (not in a function); did you mean ‘VR_mds_unload’?
  469 |     {"VR_mds_fn", (DL_FUNC) &VR_mds_fn, 11},
      |                              ^~~~~~~~~
      |                              VR_mds_unload
MASS.c:470:37: error: ‘VR_mds_init_data’ undeclared here (not in a function)
  470 |     {"VR_mds_init_data", (DL_FUNC) &VR_mds_init_data, 7},
      |                                     ^~~~~~~~~~~~~~~~
MASS.c:472:32: error: ‘VR_phi4_bin’ undeclared here (not in a function)
  472 |     {"VR_phi4_bin", (DL_FUNC) &VR_phi4_bin, 6},
      |                                ^~~~~~~~~~~
MASS.c:473:32: error: ‘VR_phi6_bin’ undeclared here (not in a function)
  473 |     {"VR_phi6_bin", (DL_FUNC) &VR_phi6_bin, 6},
      |                                ^~~~~~~~~~~
MASS.c:474:30: error: ‘VR_sammon’ undeclared here (not in a function)
  474 |     {"VR_sammon", (DL_FUNC) &VR_sammon, 9},
      |                              ^~~~~~~~~
MASS.c:475:31: error: ‘VR_ucv_bin’ undeclared here (not in a function)
  475 |     {"VR_ucv_bin", (DL_FUNC) &VR_ucv_bin, 6},
      |                               ^~~~~~~~~~
make: *** [/usr/lib/R/etc/Makeconf:191: MASS.o] Error 1
ERROR: compilation failed for package ‘MASS’
* removing ‘/home/runner/work/_temp/Library/.renv/1/MASS’
Error: Process completed with exit code 1.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.