climatetools.jl

Climate science package for Julia

https://github.com/juliaclimate/climatetools.jl

Science Score: 46.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: zenodo.org
  • Committers with academic emails
    1 of 20 committers (5.0%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (17.6%) to scientific vocabulary

Keywords

bias-correction climate-analysis climate-indices climate-science julia multiple-threads netcdf-files parallel-computing timeseries

Keywords from Contributors

hybrid-differential-equations ida neural-sde numeric pde ode mathematics dynamical-systems fluxes convex-optimization
Last synced: 6 months ago · JSON representation

Repository

Climate science package for Julia

Basic Info
Statistics
  • Stars: 122
  • Watchers: 4
  • Forks: 16
  • Open Issues: 8
  • Releases: 44
Topics
bias-correction climate-analysis climate-indices climate-science julia multiple-threads netcdf-files parallel-computing timeseries
Created about 9 years ago · Last pushed 9 months ago
Metadata Files
Readme License

README.md

Climate analysis tools in Julia

Project Status: Active – The project has reached a stable, usable state and is being actively developed. Build status Build status codecov

DOI chat MIT license

Latest release: GitHub release (latest SemVer)

Documentation

Overview

Note. Compatible with Julia 1.9 and higher

ClimateTools.jl is a collection of commonly-used tools in Climate science. Basics of climate field analysis are covered, with some forays into exploratory techniques associated with climate scenarios design. The package is aimed to ease the typical steps of analysis climate models outputs and gridded datasets (support for weather stations is a work-in-progress).

ClimateTools.jl is registered on METADATA.jl and can be added and updated with Pkg commands. See installation documentation for detailed installation instructions and Python's dependencies (for mapping features).

Climate indices and bias correction functions are coded to leverage the use of multiple threads. To gain maximum performance, use (bash shell Linux/MacOSX) export JULIA_NUM_THREADS=n, where n is the number of threads. To get an idea of the number of threads you can use type (in Julia) Sys.THREADS. This is especially useful for bias correction.

Contributors

If you'd like to have other climate indices coded, please, submit them through a Pull Request! I'd be more than happy to include them. Alternatively, provide the equation in Issues.

Features

  • Extraction. manipulation and visualization of CF-compliant netCDF datasets
  • Climate indices from The joint CCl/CLIVAR/JCOMM Expert Team (ET) on Climate Change Detection and Indices (ETCCDI) as well as custom climate indices. See list.
  • Regridding of a datasets onto another grid
  • Post-processing of climate timeseries using Quantile-Quantile mapping method (cf. Themeßl et al. 2012, Piani et al. 2010)
  • Post-processing of for extreme values (Roy et al. 2023)

Getting started

Note. More in-depth documentation is provided in the official documentation (Links: stable/latest).

julia using ClimateTools

Reading a NetCDF file

The entry point of ClimateTools is to load data with the load function. Optional polygon clipping feature is available. By providing such polygon, the load function returns a ClimGrid with grid points contained in the polygon.

julia C = load(filename::String, vari::String; poly::Array, data_units::String, start_date::Tuple, end_date::Tuple)

load returns a ClimGrid type. Using the optional poly argument, the user can provide a polygon and the returned ClimGrid will only contains the grid points inside the provided polygon. For some variable, the optional keyword argument data_units can be provided. For example, precipitation in climate models are usually provided as kg/m^2/s. By specifying data_units = mm, the load function returns accumulation at the data time resolution. Similarly, the user can provide Celsius as data_units and load will return Celsius instead of Kelvin.

The ClimGrid is a in-memory representation of a CF-compliant netCDF file for a single variable.

```julia struct ClimGrid data::AxisArray # labeled axis longrid::AbstractArray{N,2} where N # the longitude grid latgrid::AbstractArray{N,2} where N # the latitude grid msk::Array{N, 2} where N gridmapping::Dict # bindings of native grid dimensiondict::Dict model::String frequency::String experiment::String run::String project::String # CORDEX, CMIP5, etc. institute::String filename::String dataunits::String latunits::String # of the coordinate variable lonunits::String # of the coordinate variable variable::String # Type of variable (i.e. can be the same as "var", but it is changed when calculating indices) typeofvar::String # Variable type (e.g. tasmax, tasmin, pr) typeofcal::String # Calendar type timeattrib::Dict # Time attributes varattribs::Dict # Variable attributes globalattribs::Dict # Global attributes

end ```

Subsetting

Further subsets can be done in the temporal and spatial domains. spatialsubset function acts on ClimGrid type and subset the data using a user polygon. The function returns another ClimGrid.

julia C = spatialsubset(C::ClimGrid, poly:Array{N, 2} where N)

Temporal subset of the data is done with temporalsubset function, which returns a continuous timeserie between startdate and enddate.

julia C = temporalsubset(C::ClimGrid, startdate::Tuple, enddate::Tuple) Resampling is available with the resample, which returns a given period for each year (e.g. only summer months).

julia C = resample(C::ClimGrid, startmonth::Int, endmonth::Ind) C = resample(C::ClimGrid, season::String) # hardcoded seasons -> "DJF", "MAM", "JJA" and "SON"

Mapping the ClimGrid type

Mapping climate information can be done by using mapclimgrid.

julia mapclimgrid(C::ClimGrid; region = "World")

Which should return the time average of ClimGrid C over the world region.

Precipitation example

Note that if the ClimGrid data structure has 3 dimensions (time x longitude x latitude) the mapclimgrid function makes a time-average (i.e. climatological mean). Right now, there are a growing list of hardcoded regions (see help section of mapclimgrid function) and the default auto which use the maximum and minimum of the lat-long coordinates inside the ClimGrid structure. The user can also provide a polygon(s) and the mapclimgrid function will clip the grid points outside the specified polygon. Another option is to provide a mask (with dimensions identical to the spatial dimension of the ClimGrid data) which contains NaN and 1.0 and the data inside the ClimGrid struct will be clipped with the mask. Other regions will be added in the future, as well as the option to send a custom region defined by a lat-lon box.

Indices

More than 20 climate indices are available in the package, such as the annual number of tropical nights, annual maximum and minimum, etc. You can calculate such indices simply with:

julia ind = annualmax(C::ClimGrid)

Which returns another ClimGrid. You can also map this ClimGrid with the mapclimgrid function and returns the climatological mean of the annual maximum (e.g. daily precipitation in the example below). From the figure, we clearly sees the monsoon regions (India) and region with wind-driven precipitations (e.g. western sides of the oceans).

A list of indices can be found in the documentation and in the functions.jl source code.

Precipitation example

Climate indices can easily be developed by following the source code or looking at the available metadata inside a ClimGrid.

Interpolation

A typical step in climate analysis is to interpolate a given grid onto another grid. ClimateTools provides such a tool by wrapping Scipy griddata function. It is intended for visualization or as a 1st step before bias-correcting the ClimGrid dataset.

The following command will interpolate the data contained in ClimGrid A into the coordinates of ClimGrid B and returns a new ClimGrid C which contains the interpolated data of A into the grid of B.

julia C = regrid(A::ClimGrid, B::ClimGrid)

It is also possible to interpolate a ClimGrid onto specified longitude and latitude vectors.

julia C = regrid(A::ClimGrid, lon::AbstractArray{N, 1}, lat::AbstractArray{N, 1})

Bias-correction

See Documentation.

Merging ClimGrids

Sometimes, the timeseries are split among multiple files (e.g. climate models outputs). To obtain the complete timeseries, you can merge 2 ClimGrid. The method is based on the merging of two AxisArrays and is overloaded for the ClimGrid type.

julia C = merge(C1::ClimGrid, C2::ClimGrid)

Exporting

It is possible to export to a netCDF file with the command write

julia write(C::ClimGrid, filename::String)

TO-DO

  • Dashboard tool. This will return the main characteristics of a ClimGrid: maps of minimum, maximum and mean climatological values, seasonal cycle, timeseries of annual maximum, minimum and mean values, etc...
  • Create a WeatherStation type.
  • Add a more complex quantile-quantile mapping technique, combining extreme value theory and quantile-quantile standard technique

Owner

  • Name: JuliaClimate
  • Login: JuliaClimate
  • Kind: organization

GitHub Events

Total
  • Watch event: 8
  • Delete event: 2
  • Push event: 7
  • Pull request event: 5
  • Create event: 2
Last Year
  • Watch event: 8
  • Delete event: 2
  • Push event: 7
  • Pull request event: 5
  • Create event: 2

Committers

Last synced: 6 months ago

All Time
  • Total Commits: 1,280
  • Total Committers: 20
  • Avg Commits per committer: 64.0
  • Development Distribution Score (DDS): 0.103
Past Year
  • Commits: 29
  • Committers: 2
  • Avg Commits per committer: 14.5
  • Development Distribution Score (DDS): 0.103
Top Committers
Name Email Commits
Philippe Roy b****r@y****a 1,148
DominiqueCaron d****1@u****a 69
github-actions[bot] 4****] 17
Trevor James Smith t****h@l****m 11
CompatHelper Julia c****y@j****g 9
Philippe p****y@p****n 3
DL2594 r****4@h****a 3
Pietro Monticone 3****e 3
Roy, Philippe [4] R****4@h****m 3
Tony Kelman t****y@k****t 2
femtocleaner[bot] f****] 2
Éloïse Nolet-Gravel e****l@p****a 2
Elliot Saba s****t@g****m 1
Trevor James Smith t****s@m****l 1
Philippe Roy r****e@o****a 1
Gabriel Gobeil h****9@i****a 1
Fidel Thomet me@f****m 1
Julia TagBot 5****t 1
Miles Lubin m****n@g****m 1
gaelforget g****t@m****u 1

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 49
  • Total pull requests: 195
  • Average time to close issues: 7 months
  • Average time to close pull requests: 5 months
  • Total issue authors: 17
  • Total pull request authors: 14
  • Average comments per issue: 5.84
  • Average comments per pull request: 0.75
  • Merged pull requests: 126
  • Bot issues: 0
  • Bot pull requests: 91
Past Year
  • Issues: 0
  • Pull requests: 3
  • Average time to close issues: N/A
  • Average time to close pull requests: about 8 hours
  • Issue authors: 0
  • Pull request authors: 1
  • Average comments per issue: 0
  • Average comments per pull request: 0.0
  • Merged pull requests: 2
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • Balinus (27)
  • Zeitsperre (5)
  • gaelforget (3)
  • juliohm (1)
  • njdepsky (1)
  • JuliaTagBot (1)
  • joa-quim (1)
  • cvitolo (1)
  • ghost (1)
  • rfourquet (1)
  • dmetivie (1)
  • attobot (1)
  • dk-zen (1)
  • natgeo-wong (1)
  • Datseris (1)
Pull Request Authors
  • github-actions[bot] (89)
  • Balinus (81)
  • DominiqueCaron (11)
  • Zeitsperre (3)
  • pitmonticone (2)
  • femtocleaner[bot] (2)
  • tkelman (2)
  • gaelforget (2)
  • houton199 (1)
  • mlubin (1)
  • staticfloat (1)
  • fidelthomet (1)
  • elnol (1)
  • JuliaTagBot (1)
Top Labels
Issue Labels
enhancement (27) help wanted (7) bug (4) deprecate (3) good first issue (2) Polls (1) question (1) upstream (1)
Pull Request Labels
bug (1) enhancement (1)

Packages

  • Total packages: 1
  • Total downloads:
    • julia 3 total
  • Total dependent packages: 1
  • Total dependent repositories: 0
  • Total versions: 31
juliahub.com: ClimateTools

Climate science package for Julia

  • Versions: 31
  • Dependent Packages: 1
  • Dependent Repositories: 0
  • Downloads: 3 Total
Rankings
Stargazers count: 6.7%
Forks count: 9.3%
Dependent repos count: 9.9%
Average: 12.2%
Dependent packages count: 23.0%
Last synced: 6 months ago

Dependencies

REQUIRE julia
  • ArgCheck 1.0.0
  • AxisArrays 0.3.0
  • BinDeps 0.4
  • CondaBinDeps *
  • Images 0.17.3
  • Interpolations 0.8.0
  • IterTools 1.1.0
  • NCDatasets 0.9.2
  • NaNMath 0.3.2
  • NetCDF 0.7.1
  • Polynomials 0.5.1
  • ProgressMeter 0.6.0
  • PyCall 1.90.0
  • PyPlot 2.6.3
  • Reexport 0.2.0
  • Shapefile 0.4.0
  • julia 0.7
.github/workflows/TagBot.yml actions
  • JuliaRegistries/TagBot v1 composite
.github/workflows/ci-nightly.yml actions
  • actions/cache v1 composite
  • actions/checkout v2 composite
  • julia-actions/julia-buildpkg v1 composite
  • julia-actions/julia-runtest v1 composite
  • julia-actions/setup-julia v1 composite
.github/workflows/ci.yml actions
  • actions/cache v1 composite
  • actions/checkout v2 composite
  • codecov/codecov-action v1 composite
  • julia-actions/julia-buildpkg v1 composite
  • julia-actions/julia-processcoverage v1 composite
  • julia-actions/julia-runtest v1 composite
  • julia-actions/setup-julia v1 composite
.github/workflows/docs.yml actions
  • actions/checkout v2 composite
  • julia-actions/julia-buildpkg v1 composite
  • julia-actions/julia-docdeploy releases/v1 composite
  • julia-actions/setup-julia v1 composite
.github/workflows/CompatHelper.yml actions