API Reference¶
¶
Note: The triple colon (:::) syntax below is used by mkdocstrings for API auto-documentation. If your documentation build does not support mkdocstrings, replace these with standard markdown/code blocks as needed.¶
Top-level Functions¶
monet
¶
MONET: Model and Observation Evaluation Toolkit
A Python toolkit for comparing air quality models with observations. Provides utilities for pairing model output with observational data, statistical analysis, and visualization.
Main Components¶
plots : module Visualization tools for model-observation comparisons met_funcs : module Meteorological calculation utilities monet_accessor : module xarray and pandas accessor methods for MONET functionality util : module General utility functions and statistical tools
Plotting Functions¶
The plotting functions are available in the monet.plots module.
monet.plots
¶
Attributes¶
taylordiagram_function = create_taylor_diagram
module-attribute
¶
Functions¶
cmap_discretize(cmap, N)
¶
Return a discrete colormap from a continuous colormap.
Creates a new colormap by discretizing an existing continuous colormap into N distinct colors while preserving the color transitions.
Parameters¶
cmap : str or matplotlib.colors.Colormap Colormap instance or registered colormap name to discretize. Example: cm.jet, 'viridis', etc. N : int Number of discrete colors to use in the new colormap.
Returns¶
matplotlib.colors.LinearSegmentedColormap A new colormap object with N discrete colors based on the input colormap. The name will be the original colormap name with "_N" appended.
Examples¶
from numpy import arange from numpy.ma import resize from matplotlib.pyplot import imshow from matplotlib.cm import jet x = resize(arange(100), (5, 100)) djet = cmap_discretize(jet, 5) imshow(x, cmap=djet)
Source code in monet/plots/colorbars.py
colorbar_index(ncolors, cmap, minval=None, maxval=None, dtype='int', ax=None, **kwargs)
¶
Create a colorbar with discrete colors and custom tick labels.
Parameters¶
ncolors : int
Number of discrete colors to use in the colorbar.
cmap : str or matplotlib.colors.Colormap
Colormap to discretize and use for the colorbar.
minval : float, optional
Minimum value for the colorbar tick labels. If None and maxval is None,
tick labels will range from 0 to ncolors. If None and maxval is provided,
tick labels will range from 0 to maxval.
maxval : float, optional
Maximum value for the colorbar tick labels. If None, tick labels
will range from 0 or minval to ncolors.
dtype : str or type, default "int"
Data type for tick label values (e.g., "int", "float").
ax : matplotlib.axes.Axes, optional
Axes to attach the colorbar to.
**kwargs
Additional keyword arguments to pass to plt.colorbar.
Returns¶
tuple (colorbar, discretized_cmap) where: - colorbar is the matplotlib.colorbar.Colorbar instance - discretized_cmap is the discretized colormap
Source code in monet/plots/colorbars.py
kdeplot(df, title=None, label=None, ax=None, **kwargs)
¶
Create a kernel density estimate plot.
Parameters¶
df : pandas.Series or array-like Data to plot the distribution of. title : str, optional Title for the plot. label : str, optional Label for the plotted line (for legend). ax : matplotlib.axes.Axes, optional Axes to plot on. If None, creates a new figure and axes. **kwargs Additional arguments passed to seaborn's kdeplot. Common options include 'shade', 'bw', and 'color'.
Returns¶
matplotlib.axes.Axes The axes containing the plot.
Source code in monet/plots/plots.py
normval(vmin, vmax, cmap)
¶
Create a BoundaryNorm for discrete colormaps with specific bounds.
Parameters¶
vmin : float Minimum value for the colormap. vmax : float Maximum value for the colormap. cmap : matplotlib.colors.Colormap The colormap to create bounds for.
Returns¶
matplotlib.colors.BoundaryNorm A boundary norm with evenly spaced bounds from vmin to vmax in steps of 5.0.
Source code in monet/plots/plots.py
savefig(fname, *, fig=None, loc=1, decorate=True, logo=None, logo_height=None, **kwargs)
¶
Save figure and add logo.
Parameters¶
fname : str
Output file name or path. Passed to plt.savefig.
Must include desired file extension (.jpg or .png).
fig : matplotlib.figure.Figure, optional
The figure to save. If None, the current figure (plt.gcf()) is used.
loc : int
The location for the logo.
* 1 -- bottom left (default)
* 2 -- bottom right
* 3 -- top right
* 4 -- top left
decorate : bool, default: True
Whether to add the logo.
logo : str, optional
Path to the logo to be used.
If not provided, the MONET logo is used.
logo_height : float or int, optional
Desired logo height in pixels.
If not provided, the original logo image dimensions are used.
Modify to scale the logo.
**kwargs : dict
Passed to the plt.savefig function.
Returns¶
None
Notes¶
This function replaces the previous pydecorate implementation with a direct
Pillow implementation for greater flexibility and reduced dependencies.
Examples¶
import matplotlib.pyplot as plt plt.plot([1, 2], [3, 4]) savefig("plot.png", loc=1)
Source code in monet/plots/__init__.py
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 | |
scatter(df, x=None, y=None, title=None, label=None, ax=None, **kwargs)
¶
Create a scatter plot with regression line.
Parameters¶
df : pandas.DataFrame DataFrame containing the data to plot. x : str, optional Column name for x-axis values. y : str, optional Column name for y-axis values. title : str, optional Title for the plot. label : str, optional Label for the plot (for legend). ax : matplotlib.axes.Axes, optional Axes to plot on. If None, creates a new figure and axes. **kwargs Additional arguments passed to seaborn's regplot. Common options include 'scatter_kws', 'line_kws', and 'ci'.
Returns¶
matplotlib.axes.Axes The axes containing the plot.
Source code in monet/plots/plots.py
sp_scatter_bias(df, col1=None, col2=None, ax=None, outline=False, tight=True, global_map=True, map_kwargs=None, cbar_kwargs=None, val_max=None, val_min=None, **kwargs)
¶
Create a spatial scatter plot showing the bias (difference) between two columns in a DataFrame.
Parameters¶
df : pandas.DataFrame DataFrame containing latitude, longitude, and data columns to compare. col1 : str Name of the first column (reference value). col2 : str Name of the second column (comparison value). ax : matplotlib.axes.Axes, optional Axes to plot on. If None, creates a new map using draw_map. outline : bool, default False Whether to show the map outline. tight : bool, default True Whether to apply tight_layout to the figure. global_map : bool, default True Whether to set global map boundaries (-180 to 180 longitude, -90 to 90 latitude). map_kwargs : dict, default {} Keyword arguments passed to draw_map if creating a new map. cbar_kwargs : dict, default {} Keyword arguments for colorbar customization. val_max : float, optional Maximum value for color scaling. If None, uses 95th percentile of absolute differences. val_min : float, optional Minimum value for color scaling (not currently used). **kwargs : dict Additional keyword arguments passed to DataFrame.plot.scatter.
Returns¶
matplotlib.axes.Axes The axes object containing the plot.
Notes¶
The point size is scaled by the magnitude of the difference between col2 and col1, making larger differences more visually prominent. Differences are capped at 300 units for display purposes.
Examples¶
import pandas as pd df = pd.DataFrame({'latitude': [40, 41], 'longitude': [-70, -71], 'obs': [1, 2], 'mod': [1.1, 1.9]}) ax = sp_scatter_bias(df, col1='obs', col2='mod')
Source code in monet/plots/__init__.py
201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 | |
spatial(da, fig=None, ax=None, **kwargs)
¶
Create a spatial plot from an xarray.DataArray.
A convenience wrapper for xarray's plot method with consistent styling.
.. deprecated:: 24.8.1
This function is deprecated and will be removed in a future version.
Please use spatial_plot and add map features like coastlines
and gridlines manually for more control.
Parameters¶
da : xr.DataArray The data to plot spatially. fig : matplotlib.figure.Figure, optional Figure to plot on. ax : plt.Axes, optional Axes to plot on. If None, a new figure and axes will be created. **kwargs Additional keyword arguments passed to xarray's plot method.
Returns¶
t.Tuple[plt.Figure, plt.Axes] The figure and axes containing the plot.
Source code in monet/plots/plots.py
spatial_bias_scatter(ds, *, vmin=None, vmax=None, savename='', cmap='RdBu_r', fig=None, ax=None, **kwargs)
¶
Create a scatter plot showing bias on a map.
Parameters¶
ds : xr.Dataset
Dataset containing 'obs' and 'model' variables, and 'latitude' and
'longitude' coordinates.
vmin : float, optional
Minimum value for colorscale. If None, automatically determined.
vmax : float, optional
Maximum value for colorscale. If None, automatically determined.
savename : str, default ""
If provided, save the figure to this path.
cmap : str or matplotlib.colors.Colormap, default "RdBu_r"
Colormap to use for bias values.
fig : matplotlib.figure.Figure, optional
Figure to plot on.
ax : matplotlib.axes.Axes, optional
Axes to plot on.
**kwargs
Additional keyword arguments to pass to xarray.plot.scatter.
Returns¶
t.Tuple[plt.Figure, plt.Axes] The figure and axes containing the plot.
Notes¶
The scatter points are colored by the difference (model - obs) and sized by the absolute magnitude of this difference, making larger biases more visible.
Source code in monet/plots/plots.py
339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 | |
spatial_contourf(da, ax=None, **kwargs)
¶
Create a spatial plot from an xarray.DataArray using contourf.
Parameters¶
da : xarray.DataArray The data to plot. ax : matplotlib.axes.Axes, optional Axes to plot on. If None, a new figure and axes will be created. **kwargs Additional keyword arguments to pass to xarray's plot.contourf() method.
Returns¶
t.Tuple[plt.Figure, plt.Axes] The figure and axes containing the plot.
Source code in monet/plots/plots.py
spatial_imshow(da, ax=None, **kwargs)
¶
Create a spatial plot from an xarray.DataArray using imshow.
Parameters¶
da : xarray.DataArray The data to plot. ax : matplotlib.axes.Axes, optional Axes to plot on. If None, a new figure and axes will be created. **kwargs Additional keyword arguments to pass to xarray's plot.imshow() method.
Returns¶
t.Tuple[plt.Figure, plt.Axes] The figure and axes containing the plot.
Source code in monet/plots/plots.py
timeseries(df, x='time', y='obs', ax=None, plotargs=None, fillargs=None, title='', ylabel=None, label=None)
¶
Create a timeseries plot with shaded error bounds.
Parameters¶
df : pd.DataFrame
DataFrame containing the data to plot.
x : str, default "time"
Column name to use for the x-axis (time).
y : str, default "obs"
Column name to use for the y-axis (values to plot).
ax : plt.Axes, optional
Axes to plot on. If None, creates a new figure and axes.
plotargs : dict, optional
Additional arguments to pass to DataFrame.plot().
fillargs : dict, optional
Additional arguments to pass to fill_between for the error shading.
Defaults to {"alpha": 0.2}.
title : str, default ""
Title for the plot.
ylabel : str, optional
Y-axis label. If None, uses variable name and units from DataFrame.
label : str, optional
Label for the plotted line (for legend). If None, uses y.
Returns¶
plt.Axes The axes containing the plot.
Notes¶
This function groups the data by time, plots the mean values, and adds shading for ±1 standard deviation around the mean.
Source code in monet/plots/plots.py
420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 | |
wind_barbs(u, v, ax=None, thin=15, **kwargs)
¶
Create a barbs plot of wind on a map.
Parameters¶
u : xr.DataArray 2D array of u-component of wind. v : xr.DataArray 2D array of v-component of wind. ax : plt.Axes, optional Axes to plot on. thin : int, optional The thinning factor for the wind vectors. Default is 15. **kwargs Additional arguments to pass to barbs. Common options include 'length', 'pivot', 'barb_increments'.
Returns¶
t.Tuple[plt.Figure, plt.Axes] The figure and axes objects.
Source code in monet/plots/plots.py
wind_quiver(u, v, ax=None, thin=15, **kwargs)
¶
Create a quiver plot of wind vectors on a map.
Parameters¶
u : xr.DataArray 2D array of u-component of wind. v : xr.DataArray 2D array of v-component of wind. ax : plt.Axes, optional Axes to plot on. thin : int, optional The thinning factor for the wind vectors. Default is 15. **kwargs Additional arguments to pass to quiver. Common options include 'scale', 'scale_units', and 'width'.
Returns¶
t.Tuple[plt.Figure, plt.Axes] The figure and axes objects.
Source code in monet/plots/plots.py
Accessors¶
MONET extends xarray and pandas objects via accessors. These methods are available through the .monet attribute on the respective objects.
DataArray Accessor¶
Bases: BaseAccessor
DataArray accessor for MONET functionality.
Source code in monet/accessors/dataarray_accessor.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 | |
Functions¶
interpolate_vertical(target_levels, level_dim='level', tension=0.0)
¶
Vertically interpolate data to new levels using pytspack tension splines.
Parameters¶
target_levels : array-like
Target vertical level values.
level_dim : str, default: "level"
Name of the vertical dimension in the DataArray.
tension : float, default: 0.0
Tension factor for the spline. 0.0 gives a standard cubic spline.
Returns¶
xarray.DataArray
Data interpolated to target_levels.
Examples¶
da.monet.interpolate_vertical([850, 700, 500], level_dim='pressure')
Source code in monet/accessors/dataarray_accessor.py
stratify(levels, vertical, axis=1, tension=0.0)
¶
Deprecated: use interpolate_vertical instead.
Source code in monet/accessors/dataarray_accessor.py
nearest_ij(lat=None, lon=None, **kwargs)
¶
Find the nearest grid indices to given lat/lon point(s).
Parameters¶
lat : float or array-like, optional Latitude value(s). lon : float or array-like, optional Longitude value(s). **kwargs : dict Additional keyword arguments.
Returns¶
tuple (i, j) indices of nearest point(s).
Source code in monet/accessors/dataarray_accessor.py
quick_facet_time_map(map_kws=None, projection=None, colorbar=True, figsize=None, cmap=None, vmin=None, vmax=None, norm=None, dpi=150, xlabel=None, ylabel=None, suptitle=None, cbar_label=None, xticks=None, yticks=None, annotations=None, export_path=None, export_formats=None, time_dim='time', ncols=3, **kwargs)
¶
Create a facet grid of map plots for each time slice in a DataArray using Cartopy. Convention-aware: supports both CF/COARDS and UGRID.
Parameters¶
map_kws : dict, optional Dictionary of keyword arguments for map features. projection : cartopy.crs.Projection, optional Cartopy projection to use. Defaults to PlateCarree. colorbar : bool, default: True Whether to add a colorbar (shared). figsize : tuple, optional Figure size. cmap : str or Colormap, optional Colormap to use. vmin, vmax : float, optional Color limits. norm : Normalize, optional Matplotlib normalization. dpi : int, optional Dots per inch for export. xlabel, ylabel, suptitle : str, optional Axis labels and super title. cbar_label : str, optional Label for the colorbar. xticks, yticks : list, optional Custom tick locations. annotations : list of dict, optional List of annotation dicts for each subplot. export_path : str, optional Path to export the figure (without extension). export_formats : list, optional List of formats to export (e.g., ["png", "pdf"]). time_dim : str, default: "time" Name of the time dimension. ncols : int, default: 3 Number of columns in the facet grid. **kwargs : dict Additional keyword arguments for plotting.
Returns¶
fig : matplotlib.figure.Figure The matplotlib figure object. axes : ndarray of matplotlib.axes.Axes The matplotlib axes objects.
Source code in monet/accessors/dataarray_accessor.py
291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 | |
Dataset Accessor¶
Bases: BaseAccessor
Source code in monet/accessors/dataset_accessor.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 | |
Functions¶
interpolate_vertical(target_levels, level_dim='level', tension=0.0)
¶
Vertically interpolate all variables in the Dataset to new levels using pytspack tension splines.
Parameters¶
target_levels : array-like
Target vertical level values.
level_dim : str, default: "level"
Name of the vertical dimension to interpolate along.
tension : float, default: 0.0
Tension factor for the spline. 0.0 gives a standard cubic spline.
Returns¶
xarray.Dataset
Dataset with all variables that have level_dim interpolated to target_levels.
Examples¶
ds.monet.interpolate_vertical([850, 700, 500], level_dim='pressure')
Source code in monet/accessors/dataset_accessor.py
stratify(levels, vertical, axis=1, tension=0.0)
¶
Deprecated: use interpolate_vertical instead.
Source code in monet/accessors/dataset_accessor.py
nearest_ij(lat=None, lon=None, **kwargs)
¶
Find the nearest grid indices to given lat/lon point(s).
Parameters¶
lat : float or array-like, optional Latitude value(s). lon : float or array-like, optional Longitude value(s). **kwargs : dict Additional keyword arguments.
Returns¶
tuple (i, j) indices of nearest point(s).
Source code in monet/accessors/dataset_accessor.py
quick_facet_time_map(var, map_kws=None, projection=None, colorbar=True, figsize=None, cmap=None, vmin=None, vmax=None, norm=None, dpi=150, xlabel=None, ylabel=None, suptitle=None, cbar_label=None, xticks=None, yticks=None, annotations=None, export_path=None, export_formats=None, time_dim='time', ncols=3, **kwargs)
¶
Create a facet grid of map plots for each time slice in a Dataset variable using Cartopy. Convention-aware: supports both CF/COARDS and UGRID.
Parameters¶
var : str Name of the variable in the dataset to plot. map_kws : dict, optional Dictionary of keyword arguments for map features. projection : cartopy.crs.Projection, optional Cartopy projection to use. Defaults to PlateCarree. colorbar : bool, default: True Whether to add a colorbar (shared). figsize : tuple, optional Figure size. cmap : str or Colormap, optional Colormap to use. vmin, vmax : float, optional Color limits. norm : Normalize, optional Matplotlib normalization. dpi : int, optional Dots per inch for export. xlabel, ylabel, suptitle : str, optional Axis labels and super title. cbar_label : str, optional Label for the colorbar. xticks, yticks : list, optional Custom tick locations. annotations : list of dict, optional List of annotation dicts for each subplot. export_path : str, optional Path to export the figure (without extension). export_formats : list, optional List of formats to export (e.g., ["png", "pdf"]). time_dim : str, default: "time" Name of the time dimension. ncols : int, default: 3 Number of columns in the facet grid. **kwargs : dict Additional keyword arguments for plotting.
Returns¶
fig : matplotlib.figure.Figure The matplotlib figure object. axes : ndarray of matplotlib.axes.Axes The matplotlib axes objects.
Source code in monet/accessors/dataset_accessor.py
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 | |
DataFrame Accessor¶
Bases: BaseAccessor
Pandas DataFrame accessor for MONET functionality.
This accessor adds MONET-specific methods to pandas DataFrames.
Source code in monet/accessors/pandas_accessor.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 | |
Attributes¶
center
property
¶
The geographic center point of this DataFrame.
.. note::
Currently just the lon and lat mean values, not necessarily representative of the geographic center.
Returns¶
tuple (lon, lat)
Functions¶
to_ascii2nc_df(grib_code=126, height_msl=0.0, column='aod_550nm', message_type='ADPUPA', pressure=1000.0, qc=None, height_agl=None)
¶
Convert DataFrame to MET ASCII2NC format.
Parameters¶
grib_code : int, default: 126 GRIB code for the variable. height_msl : float or str, default: 0.0 Height above mean sea level (meters). column : str, default: "aod_550nm" Column name from which to get observation values. message_type : str, default: "ADPUPA" Message type for MET. pressure : float or str, default: 1000.0 Pressure level (mb). qc : str, optional Quality control value. If None, defaults to 0. height_agl : float or str, optional Height above ground level (meters). If None, defaults to 0.
Returns¶
pandas.DataFrame DataFrame formatted for MET ASCII2NC.
Source code in monet/accessors/pandas_accessor.py
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 | |
to_ascii2nc_list(**kwargs)
¶
Convert DataFrame to MET ASCII2NC list format.
Parameters¶
**kwargs : dict Keyword arguments passed to to_ascii2nc_df().
Returns¶
list of list List of lists formatted for MET ASCII2NC.
Source code in monet/accessors/pandas_accessor.py
rename_for_monet(df)
staticmethod
¶
Rename latitude and longitude columns in the DataFrame to MONET standard.
Parameters¶
df : pandas.DataFrame DataFrame to rename columns in.
Returns¶
pandas.DataFrame DataFrame with renamed latitude/longitude columns.
Source code in monet/accessors/pandas_accessor.py
remap_nearest(df, radius_of_influence=100000.0, combine=False)
¶
Remap data using nearest neighbor interpolation (xregrid).
Parameters¶
df : pandas.DataFrame DataFrame to remap. radius_of_influence : float, default: 1e5 Search radius in meters (unused in xregrid). combine : bool, default: False Whether to combine the remapped data with the original data.
Returns¶
pandas.DataFrame Remapped DataFrame.
Source code in monet/accessors/pandas_accessor.py
pair(model, **kwargs)
¶
Pair this DataFrame with model data.
Parameters¶
model : xarray.Dataset or xarray.DataArray
Model data to pair with.
**kwargs : dict
Additional arguments passed to monet.pair.
Returns¶
pandas.DataFrame or dask.dataframe.DataFrame The DataFrame with paired model data.
Source code in monet/accessors/pandas_accessor.py
cftime_to_datetime64(col=None)
¶
Convert cftime column to numpy datetime64.
Parameters¶
col : str, optional Name of the column to convert. If None, tries to detect the time column.
Returns¶
pandas.DataFrame DataFrame with converted time column.
Source code in monet/accessors/pandas_accessor.py
plot_points_map(lon_col='longitude', lat_col='latitude', projection=None, color='C0', marker='o', size=40, edgecolor='k', alpha=0.8, map_kws=None, figsize=(8, 6), dpi=150, title=None, export_path=None, export_formats=None, **kwargs)
¶
Plot points from this DataFrame on a Cartopy map.
Source code in monet/accessors/pandas_accessor.py
plot_lines_map(lon_col='longitude', lat_col='latitude', group_col=None, projection=None, color='C0', linewidth=2, alpha=0.8, map_kws=None, figsize=(8, 6), dpi=150, title=None, export_path=None, export_formats=None, **kwargs)
¶
Plot lines from this DataFrame on a Cartopy map. Optionally group by a column.
Source code in monet/accessors/pandas_accessor.py
Utility Functions¶
General Utilities¶
monet.util.tools
¶
Utility tools for MONET.
Functions¶
nearest(items, pivot)
¶
Find the nearest value to pivot in a collection.
This implementation is backend-agnostic and supports Dask-backed xarray objects using xarray.apply_ufunc.
Parameters¶
items : array-like Collection of values to search through. pivot : float, int, or array-like The value(s) to find the nearest match to.
Returns¶
closest_value : same type as input The item from the collection that is closest to the pivot value.
Source code in monet/util/tools.py
search_listinlist(array1, array2)
¶
Find matching indices between two arrays.
Parameters¶
array1 : numpy.ndarray First array to search for matches array2 : numpy.ndarray Second array to search for matches
Returns¶
tuple (index1, index2) containing: - index1: sorted array of indices in array1 where matches were found - index2: sorted array of indices in array2 where matches were found
Source code in monet/util/tools.py
linregress(x, y, dim=None)
¶
Perform a linear regression.
This implementation is backend-agnostic and supports Dask-backed xarray objects using xarray.apply_ufunc. If x and y are multi-dimensional, the regression is performed over the specified dimension (for xarray) or the last dimension (for numpy).
Parameters¶
x : numpy.ndarray or xarray.DataArray Independent variable values. y : numpy.ndarray or xarray.DataArray Dependent variable values. dim : str, optional The dimension along which to perform the regression. Only used if inputs are xarray objects. If None and inputs are xarray, the last dimension is used.
Returns¶
slope, intercept, r_squared, std_err : same type as input - slope: regression line slope - intercept: regression line y-intercept - r_squared: coefficient of determination - std_err: standard error of the residuals
Source code in monet/util/tools.py
257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 | |
findclosest(list_obj, value)
¶
Find the index and value of the closest element to a target value.
This implementation is backend-agnostic and supports Dask-backed xarray objects.
Parameters¶
list_obj : array-like Collection of values to search through. value : float, int, or array-like The target value(s) to find the closest match to.
Returns¶
index, closest_value : same type as input - index: the position in list_obj of the closest value - closest_value: the value from list_obj that is closest to the target
Source code in monet/util/tools.py
kolmogorov_zurbenko_filter(df, col, window, iterations)
¶
Apply a Kolmogorov-Zurbenko filter to a specific column in a DataFrame.
A Kolmogorov-Zurbenko filter is a low-pass filter created by iteratively applying a moving average of specified window length. This implementation applies the filter to a DataFrame grouped by site ID.
Parameters¶
df : pandas.DataFrame DataFrame containing the data to filter. col : str Column name to apply the filter to. window : int Size of the moving average window. iterations : int Number of times to apply the moving average filter.
Returns¶
pandas.DataFrame DataFrame with original data and filtered values merged in.
Source code in monet/util/tools.py
wsdir2uv(ws, wdir)
¶
Convert wind speed and direction to U and V components.
This implementation is backend-agnostic and supports Dask-backed xarray objects using xarray.apply_ufunc.
Parameters¶
ws : float, numpy.ndarray, or xarray.DataArray Wind speed values. wdir : float, numpy.ndarray, or xarray.DataArray Wind direction values in degrees (meteorological convention: 0=North, 90=East).
Returns¶
u, v : same type as input - u is the zonal wind component (positive for eastward wind) - v is the meridional wind component (positive for northward wind)
Source code in monet/util/tools.py
get_relhum(temp, press, vap)
¶
Calculate relative humidity from temperature, pressure and vapor pressure.
This implementation is backend-agnostic and supports Dask-backed xarray objects using xarray.apply_ufunc.
Parameters¶
temp : float, numpy.ndarray, or xarray.DataArray Temperature in Kelvin press : float, numpy.ndarray, or xarray.DataArray Pressure in hPa/mb vap : float, numpy.ndarray, or xarray.DataArray Vapor pressure in hPa/mb
Returns¶
relhum : same type as input Relative humidity as a percentage (0-100)
Source code in monet/util/tools.py
long_to_wide(df)
¶
Convert a DataFrame from long (stacked) to wide format.
Parameters¶
df : pandas.DataFrame DataFrame in long format with 'time', 'siteid', 'variable', 'obs', and 'units' columns
Returns¶
pandas.DataFrame DataFrame in wide format with variables as columns
Source code in monet/util/tools.py
calc_8hr_rolling_max(df, col=None, window=None)
¶
Calculate 8-hour rolling maximum values.
Parameters¶
df : pandas.DataFrame Input data with 'time_local' and 'siteid' columns col : str Column name to calculate rolling max for window : int Rolling window size in hours
Returns¶
pandas.DataFrame DataFrame with added column containing 8-hour maxima
Source code in monet/util/tools.py
calc_24hr_ave(df, col=None)
¶
Calculate 24-hour averages.
Parameters¶
df : pandas.DataFrame Input data with 'time_local' and 'siteid' columns col : str Column name to average
Returns¶
pandas.DataFrame DataFrame with added column containing daily averages
Source code in monet/util/tools.py
calc_3hr_ave(df, col=None)
¶
Calculate 3-hour averages.
Parameters¶
df : pandas.DataFrame Input data with 'time_local' and 'siteid' columns col : str Column name to average
Returns¶
pandas.DataFrame DataFrame with added column containing 3-hour averages
Source code in monet/util/tools.py
calc_annual_ave(df, col=None)
¶
Calculate annual averages.
Parameters¶
df : pandas.DataFrame Input data with 'time_local' and 'siteid' columns col : str Column name to average
Returns¶
pandas.DataFrame DataFrame with added column containing annual averages
Source code in monet/util/tools.py
get_giorgi_region_bounds(index=None, acronym=None)
¶
Get lat/lon boundaries for a Giorgi region.
Giorgi regions are geographical regions defined for climate studies. Returns bounds for a region specified by index number or acronym.
Parameters¶
index : int, optional Region index number (1-22) acronym : str, optional Region acronym (e.g. 'NAU', 'SAU', etc)
Returns¶
numpy.ndarray Array containing [latmin, lonmin, latmax, lonmax, acronym]
Notes¶
Either index or acronym must be provided. For region definitions see: https://web.northeastern.edu/sds/web/demsos/images_002/subregions.jpg
Source code in monet/util/tools.py
get_giorgi_region_df(dset)
¶
Add Giorgi region index and acronym to DataFrame or Dataset.
This implementation is backend-agnostic and supports Dask-backed xarray objects using xarray.apply_ufunc. Convention-aware: supports CF/COARDS and UGRID via MONET accessors.
Parameters¶
dset : pandas.DataFrame or xarray.Dataset DataFrame or Dataset containing latitude and longitude.
Returns¶
pandas.DataFrame or xarray.Dataset Input object with added columns/variables: - GIORGI_INDEX: region index number (float, to accommodate NaN) - GIORGI_ACRO: region acronym (str)
Source code in monet/util/tools.py
get_epa_region_bounds(index=None, acronym=None)
¶
Get lat/lon boundaries for an EPA region.
Parameters¶
index : int, optional EPA region number acronym : str, optional EPA region acronym
Returns¶
list [latmin, lonmin, latmax, lonmax, acronym]
Source code in monet/util/tools.py
get_epa_region_df(dset)
¶
Add EPA region index and acronym to DataFrame or Dataset.
This implementation is backend-agnostic and supports Dask-backed xarray objects using xarray.apply_ufunc. Convention-aware: supports CF/COARDS and UGRID via MONET accessors.
Parameters¶
dset : pandas.DataFrame or xarray.Dataset DataFrame or Dataset containing latitude and longitude.
Returns¶
pandas.DataFrame or xarray.Dataset Input object with added columns/variables: - EPA_INDEX: region index number (float, to accommodate NaN) - EPA_ACRO: region acronym (str)
Source code in monet/util/tools.py
add_mask(dset, mask_name, resolution=0.05, new_var=None)
¶
Add a mask to a DataFrame or Dataset using the pre-computed mask system.
Parameters¶
dset : pandas.DataFrame or xarray.Dataset Input object containing latitude and longitude. mask_name : str Name of the mask (e.g., 'giorgi', 'ipcc_ar6', 'epa_eco', 'timezones', 'epa_admin', 'land'). resolution : float, default: 0.05 Resolution of the mask in degrees. new_var : str, optional Name of the new variable/column to create. Defaults to mask_name.
Returns¶
pandas.DataFrame or xarray.Dataset The input object with the added mask information.
Source code in monet/util/tools.py
calc_13_category_usda_soil_type(clay, sand, silt)
¶
Calculate the 13 category USDA soil type from clay, sand and silt percentages.
Categories: 0 -- WATER 1 -- SAND 2 -- LOAMY SAND 3 -- SANDY LOAM 4 -- SILT LOAM 5 -- SILT 6 -- LOAM 7 -- SANDY CLAY LOAM 8 -- SILTY CLAY LOAM 9 -- CLAY LOAM 10 -- SANDY CLAY 11 -- SILTY CLAY 12 -- CLAY
Parameters¶
clay : float, numpy.ndarray, or xarray.DataArray Clay percentage (0-100). sand : float, numpy.ndarray, or xarray.DataArray Sand percentage (0-100). silt : float, numpy.ndarray, or xarray.DataArray Silt percentage (0-100).
Returns¶
stype : same type as input USDA soil type category (0-12).
Source code in monet/util/tools.py
Meteorological Functions¶
monet.met_funcs
¶
This package contains the main routines for estimating variables related to the Monin-Obukhov (MO) Similarity Theory, such as MO length, adiabatic correctors for heat and momentum transport. It requires the following package.
References¶
.. [Brutsaert2005] Brutsaert, W. (2005). Hydrology: an introduction (Vol. 61, No. 8). Cambridge: Cambridge University Press.
.. [Norman2000] Norman, J. M., W. P. Kustas, J. H. Prueger, and G. R. Diak (2000), Surface flux estimation using radiometric temperature: A dual-temperature-difference method to minimize measurement errors, Water Resour. Res., 36(8), 2263-2274, https://doi.org/10.1029/2000WR900033.
Functions¶
calc_pressure(z)
¶
Calculates the barometric pressure above sea level.
Parameters¶
z: float or xarray.DataArray height above sea level (m).
Returns¶
p: float or xarray.DataArray air pressure (mb).
Source code in monet/met_funcs.py
calc_rho(p, ea, T_A_K)
¶
Calculates the density of air.
Parameters¶
p : float or xarray.DataArray total air pressure (dry air + water vapour) (mb). ea : float or xarray.DataArray water vapor pressure at reference height above canopy (mb). T_A_K : float or xarray.DataArray air temperature at reference height (Kelvin).
Returns¶
rho : float or xarray.DataArray density of air (kg m-3).
References¶
based on equation (2.6) from Brutsaert (2005): Hydrology - An Introduction (pp 25).
Source code in monet/met_funcs.py
calc_vapor_pressure(T_K)
¶
Calculate the saturation water vapour pressure.
Parameters¶
T_K : float or xarray.DataArray temperature (K).
Returns¶
ea : float or xarray.DataArray saturation water vapour pressure (mb).
Source code in monet/met_funcs.py
calc_mixing_ratio(ea, p)
¶
Calculate ratio of mass of water vapour to the mass of dry air (-)
Parameters¶
ea : float or xarray.DataArray water vapor pressure at reference height (mb). p : float or xarray.DataArray total air pressure (dry air + water vapour) at reference height (mb).
Returns¶
r : float or xarray.DataArray mixing ratio (-)
References¶
https://glossary.ametsoc.org/wiki/Mixing_ratio
Source code in monet/met_funcs.py
calc_sun_angles(lat, lon, stdlon, doy, ftime)
¶
Calculates the Sun Zenith and Azimuth Angles (SZA & SAA).
Parameters¶
lat : float or xarray.DataArray latitude of the site (degrees). lon : float or xarray.DataArray longitude of the site (degrees). stdlon : float or xarray.DataArray central longitude of the time zone of the site (degrees). doy : float or xarray.DataArray day of year of measurement (1-366). ftime : float or xarray.DataArray time of measurement (decimal hours).
Returns¶
sza, saa : float or xarray.DataArray Sun Zenith Angle (degrees) and Sun Azimuth Angle (degrees).
Source code in monet/met_funcs.py
calc_L(ustar, T_A_K, rho, c_p, H, LE)
¶
Calculates the Monin-Obukhov length.
Parameters¶
ustar : float or xarray.DataArray friction velocity (m s-1). T_A_K : float or xarray.DataArray air temperature (Kelvin). rho : float or xarray.DataArray air density (kg m-3). c_p : float or xarray.DataArray Heat capacity of air at constant pressure (J kg-1 K-1). H : float or xarray.DataArray sensible heat flux (W m-2). LE : float or xarray.DataArray latent heat flux (W m-2).
Returns¶
L : float or xarray.DataArray Obukhov stability length (m).
References¶
[Brutsaert2005]_
Source code in monet/met_funcs.py
calc_u_star(u, z_u, L, d_0, z_0M)
¶
Friction velocity.
Parameters¶
u : float or xarray.DataArray wind speed above the surface (m s-1). z_u : float or xarray.DataArray wind speed measurement height (m). L : float or xarray.DataArray Monin Obukhov stability length (m). d_0 : float or xarray.DataArray zero-plane displacement height (m). z_0M : float or xarray.DataArray aerodynamic roughness length for momentum transport (m).
Returns¶
u_star : float or xarray.DataArray friction velocity (m s-1).
References¶
[Brutsaert2005]_
Source code in monet/met_funcs.py
calc_Psi_H(zoL)
¶
Calculates the adiabatic correction factor for heat transport.
Parameters¶
zoL : float or xarray.DataArray stability coefficient (unitless).
Returns¶
Psi_H : float or xarray.DataArray adiabatic corrector factor for heat transport (unitless).
References¶
[Brutsaert2005]_
Source code in monet/met_funcs.py
calc_Psi_M(zoL)
¶
Adiabatic correction factor for momentum transport.
Parameters¶
zoL : float or xarray.DataArray stability coefficient (unitless).
Returns¶
Psi_M : float or xarray.DataArray adiabatic corrector factor for momentum transport (unitless).
References¶
[Brutsaert2005]_
Source code in monet/met_funcs.py
Vertical Coordinate Utilities¶
monet.util.vertical
¶
Vertical coordinate utilities for MONET.
Functions¶
calc_fv3_pressure(ak, bk, ps, dim='z')
¶
Calculate pressure from FV3 hybrid coordinate coefficients.
The pressure at a given level is calculated using the formula: P = ak + bk * ps
Parameters¶
ak : xarray.DataArray or numpy.ndarray Hybrid coordinate coefficient 'ak'. Usually in Pa. bk : xarray.DataArray or numpy.ndarray Hybrid coordinate coefficient 'bk'. ps : xarray.DataArray or numpy.ndarray Surface pressure. Usually in Pa. dim : str, optional Name of the vertical dimension. Default is 'z'.
Returns¶
xarray.DataArray The calculated pressure.
Notes¶
This function is backend-agnostic and supports both NumPy and Dask-backed xarray objects.
Source code in monet/util/vertical.py
calc_fv3_height(temp, phalf, hsfc=0.0, dim='z')
¶
Calculate geopotential height using the hypsometric equation.
Calculates geopotential height at layer interfaces (phalf levels) by integrating the hypsometric equation from the surface upwards.
Parameters¶
temp : xarray.DataArray or numpy.ndarray Air temperature at layer centers (K). Shape: (n_layers, ...) phalf : xarray.DataArray or numpy.ndarray Pressure at layer interfaces (Pa). Shape: (n_layers + 1, ...) hsfc : xarray.DataArray or numpy.ndarray, default 0.0 Surface geopotential height (m). dim : str, optional Name of the vertical dimension. Default is 'z'.
Returns¶
xarray.DataArray Geopotential height at interfaces (m). Shape: (n_layers + 1, ...)
Notes¶
This function assumes the vertical dimension is ordered from top to bottom (index 0 is the top of the atmosphere, last index is the surface). It is backend-agnostic and supports both NumPy and Dask-backed xarray objects.
Source code in monet/util/vertical.py
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 | |
Combine Tool¶
monet.util.combinetool
¶
Functions¶
pair(model, obs, *, method='nearest', interp_time=False, suffix='_model', merge=True, **kwargs)
¶
Unified interface for pairing model and observation data.
Supports xarray (Dataset/DataArray) and DataFrame (pandas/dask) objects. Maintains laziness for Dask-backed objects. Supports both CF/COARDS and UGRID conventions via automatic standardization.
Parameters¶
model : xarray.Dataset or xarray.DataArray Model data (usually gridded). obs : xarray.Dataset, xarray.DataArray, pandas.DataFrame, or dask.dataframe.DataFrame Observation data. method : str, default 'nearest' Spatial interpolation method. interp_time : bool, default False Whether to interpolate in time. suffix : str, default '_model' Suffix for model variables if names conflict. merge : bool, default True Whether to merge the paired data with the original observations. **kwargs : dict Additional arguments passed to regridding backend.
Returns¶
xarray.Dataset, xarray.DataArray, pandas.DataFrame, or dask.dataframe.DataFrame
Matched object of the same type as obs.
Examples¶
paired_df = pair(model_ds, obs_df, method='bilinear')
Source code in monet/util/combinetool.py
combine_da_to_df(da, df, *, merge=True, suffix=None, **kwargs)
¶
Combine xarray data with point observations in a dataframe.
Note: This is a backward compatibility wrapper for monet.pair.
Parameters¶
da : xarray.DataArray or xarray.Dataset
Gridded data to be interpolated to target points.
df : pandas.DataFrame
Point observations.
merge : bool, default True
Whether to merge with original DataFrame.
suffix : str, optional
Suffix to add to variable names.
**kwargs : dict
Passed to pair.
Returns¶
pandas.DataFrame Combined DataFrame.
Source code in monet/util/combinetool.py
combine_da_to_da(source, target, *, merge=True, interp_time=False, **kwargs)
¶
Combine gridded data with point observation data in xarray format.
Note: This is a backward compatibility wrapper. It restores the old behavior
of expanding 1D coordinates to a 2D meshgrid for compatibility with legacy tests.
For point-to-point pairing, use monet.pair.
Parameters¶
source : xarray.DataArray or xarray.Dataset
Gridded data to interpolate from.
target : xarray.DataArray or xarray.Dataset
Target grid or point observation data.
merge : bool, default True
Whether to merge.
interp_time : bool, default False
Whether to interpolate in time.
**kwargs : dict
Additional arguments passed to resample.
Returns¶
xarray.Dataset or xarray.DataArray Combined Dataset.
Source code in monet/util/combinetool.py
combine_da_to_height_profile(da, dset, *, radius_of_influence=12000.0)
¶
This function will combine an xarray.DataArray to a 2d dataset with dimensions (time,z)
Parameters¶
da : xarray.DataArray dset : xarray.Dataset Dataset containing vertical profile observations radius_of_influence : float, optional Search radius for nearest neighbor interpolation in meters. Default is 12km.
Returns¶
xarray.Dataset Combined dataset with interpolated model values at observation heights
Source code in monet/util/combinetool.py
Error Metrics¶
Statistical metrics are provided by the monet-stats package, and exposed through monet.util.stats.
monet.util.stats
¶
Statistics utilities module - compatibility layer for monet_stats.
This module imports monet_stats and re-exports all functions for backward compatibility. The actual statistical functions are now provided by the monet-stats package.