The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

Type: Package
Title: Simulating Climate Data for Research and Modelling
Version: 0.1.1
Maintainer: Isaac Osei <ikemillar65@gmail.com>
Description: Generate synthetic station-based monthly climate time-series including temperature and rainfall, export to Network Common Data Form (NetCDF), and provide visualization helpers for climate workflows. The approach is inspired by statistical weather generator concepts described in Wilks (1992) <doi:10.1016/S0168-1923(99)00037-4> and Richardson (1981) <doi:10.1029/WR017i001p00182>.
License: MIT + file LICENSE
Encoding: UTF-8
Imports: ncdf4, lubridate, readr, dplyr, ggplot2, rlang, tidyr, vroom, tibble, stats
Suggests: testthat (≥ 3.0.0), knitr, rmarkdown
VignetteBuilder: knitr
RoxygenNote: 7.3.3
Config/testthat/edition: 3
URL: https://github.com/ikemillar/CDSim
BugReports: https://github.com/ikemillar/CDSim/issues
NeedsCompilation: no
Packaged: 2025-12-09 19:40:57 UTC; isaacosei
Author: Isaac Osei [aut, cre], Acheampong Baafi-Adomako [aut], Sivaparvathi Dusari [aut]
Repository: CRAN
Date/Publication: 2025-12-15 18:40:08 UTC

CDSim: Climate Data Simulation Toolkit

Description

Tools for generating and exporting synthetic climate observation datasets.

Author(s)

Isaac Osei and Acheampong Baafi-Adomako and Sivaparvathi Dusari

See Also

Useful links:


Create or load station metadata

Description

Create a station metadata table (Station, LON, LAT) either by:

Usage

create_stations(
  source = NULL,
  n = 10,
  bbox = c(-3.5, 1.5, 4.5, 11.5),
  seed = NULL
)

Arguments

source

Path to CSV file OR a data.frame with Station/LON/LAT OR NULL (to generate synthetic).

n

Integer number of stations to generate when source = NULL. Default 10.

bbox

numeric vector c(min_lon, max_lon, min_lat, max_lat). Default ~ Ghana bounding box.

seed

Optional numeric to make generation reproducible.

Value

A data.frame with columns Station, LON, LAT.

Examples

create_stations(n = 5, seed = 42)
create_stations(data.frame(Station="A", LON=0, LAT=5))

Plot Station Time Series with Seasonal Detection

Description

Creates a time-series plot for climate variables with automatic hemisphere-based season detection.

Usage

plot_station_timeseries(
  df,
  station,
  var = "Avg.Tn",
  smooth = TRUE,
  theme_dark = FALSE
)

Arguments

df

A tidy dataset containing columns: Station, Date, LAT, and variables.

station

Station name.

var

Climate variable to plot.

smooth

Add LOESS smoothing line.

theme_dark

Use dark theme.

Value

A ggplot object.

Examples

stations <- create_stations(n = 3)
sim <- simulate_climate_series(stations)
plot_station_timeseries(sim, station = "Station_1", var = "Avg.Tn")


Make a safe filename

Description

Ensures file names contain only safe ASCII characters.

Usage

safe_name(x)

safe_name(x)

Arguments

x

A character string to clean.

Value

A cleaned filename string.


Simulate monthly climate time series for stations

Description

Simulate monthly Tmin, Tmax, monthly total rainfall (Sum.Rf) and mean daily rainfall (Avg.Rf) for each station across a year range.

Usage

simulate_climate_series(
  stations,
  start_year = 1981,
  end_year = 2020,
  seed = NULL
)

Arguments

stations

data.frame from create_stations() (Station, LON, LAT)

start_year

integer (e.g., 1981)

end_year

integer (e.g., 2020)

seed

optional numeric seed

Details

This function simulates synthetic time-series climate data based on...

Value

A tidy data.frame with one row per station × month containing: Station, LON, LAT, Year, Month, Date, Avg.Tn, Avg.Tx, Sum.Rf, Avg.Rf

See Also

write_station_csv(), write_station_netcdf()

Examples

st <- create_stations(n = 3, seed = 1)
sim <- simulate_climate_series(st, 1981, 1982, seed = 42)
head(sim)

Visualization Functions for Climate Data

Description

Visualization Functions for Climate Data


Write station CSV Exports a simulated climate station dataset to a CSV file.

Description

Write station CSV Exports a simulated climate station dataset to a CSV file.

Usage

write_station_csv(df, file = "simulated_station_climate.csv")

Arguments

df

A dataframe returned by simulate_climate_series().

file

The output CSV filename.

Value

Returns the file path invisibly.

Examples

stations <- create_stations(n = 3)
sim <- simulate_climate_series(stations)
tmp <- tempfile(fileext = ".csv")
write_station_csv(sim, tmp)


Write station NetCDF (station x time) Exports a simulated climate station dataset to a NetCDF file.

Description

Write station NetCDF (station x time) Exports a simulated climate station dataset to a NetCDF file.

Usage

write_station_netcdf(
  df,
  out_nc = "simulated_station_climate.nc",
  fillvalue = -9999
)

Arguments

df

station x time long dataframe returned by simulate_climate_series()

out_nc

Output NetCDF filename

fillvalue

Value used for missing entries

Value

Returns the file path invisibly.

Examples

stations <- create_stations(n = 3)
sim <- simulate_climate_series(stations)
tmp <- tempfile(fileext = ".nc")
write_station_netcdf(sim, tmp)

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.