Useful TypeScript functions for climate calculations and weather data in journalism projects. Part of the journalism library.
The library is maintained by Nael Shiab, computational journalist and senior data producer for CBC News.
To learn how to use this library and more, check out Code Like a Journalist, a free and open-source data analysis and data visualization course in TypeScript. You might also find simple-data-analysis useful.
Use import
and set "type": "module" in your project's package.json.
npm install @nshiab/journalism-climate
import { getEnvironmentCanadaRecords } from "@nshiab/journalism-climate";
const records = await getEnvironmentCanadaRecords(
[{ lat: 45.52, lon: -73.65, name: "Montreal" }],
"DAILY MAXIMUM TEMPERATURE",
["2023-07-01", "2023-07-01"],
);
console.table(records);
For browser projects, use the /web entry point:
import { getHumidex } from "@nshiab/journalism-climate/web";
console.log(getHumidex(30, 70)); // 41
To start a data project with folders, configuration and documentation for AI agents, run:
npx @nshiab/setup-data-project
See CONTRIBUTING.md for development commands.