API reference¶
Here we will add the documentation for selected modules.
Grid¶
Grid |
A structured grid on a map projection. |
Grid methods¶
Grid.extent_in_crs |
Get the extent of the grid in a desired crs. |
Grid.ij_to_crs |
Converts local i, j to cartesian coordinates in a specified crs |
Grid.map_gridded_data |
Reprojects any structured data onto the local grid. |
Grid.region_of_interest |
Computes a region of interest (ROI). |
Grid.regrid |
Make a copy of the grid with an updated spatial resolution. |
Grid.transform |
Converts any coordinates into the local grid. |
Georeferencing utils¶
check_crs |
Checks if the crs represents a valid grid, projection or ESPG string. |
proj_is_same |
Checks is two pyproj projections are equal. |
proj_to_cartopy |
Converts a pyproj.Proj to a cartopy.crs.Projection |
transform_proj |
Wrapper around the pyproj.transform function. |
transform_geometry |
Reprojects a shapely geometry. |
transform_geopandas |
Reprojects a geopandas dataframe. |
mercator_grid |
Local transverse mercator map centered on a specified point. |
Graphics¶
DataLevels |
Assigns the right color to your data. |
Map |
Plotting georeferenced data. |
get_cmap |
Get a colormap from mpl, and also those defined by Salem. |
Map & DataLevels methods¶
DataLevels.append_colorbar |
Appends a colorbar to existing axes |
DataLevels.colorbarbase |
Returns a ColorbarBase to add to the cax axis. |
DataLevels.set_cmap |
Set a colormap. |
DataLevels.set_data |
Any kind of data array (also masked). |
DataLevels.set_plot_params |
Shortcut to all parameters related to the plot. |
DataLevels.set_extend |
Colorbar extensions: ‘neither’ | ‘both’ | ‘min’ | ‘max’ |
DataLevels.set_levels |
Levels you define. |
DataLevels.set_nlevels |
Automatic N levels. |
DataLevels.set_vmax |
Maximum level value. |
DataLevels.set_vmin |
Mininum level value. |
DataLevels.visualize |
Quick plot, useful for debugging. |
DataLevels.plot |
Add a kind of plot of the data to an axis. |
Map methods¶
Map.set_data |
Adds data to the plot. |
Map.set_contour |
Adds data to contour on the map. |
Map.set_contourf |
Adds data to contourfill on the map. |
Map.set_geometry |
Adds any Shapely geometry to the map. |
Map.set_lonlat_contours |
Add longitude and latitude contours to the map. |
Map.set_points |
Shortcut for set_geometry() accepting coordinates as input. |
Map.set_rgb |
Manually force to a rgb img |
Map.set_shapefile |
Add a shapefile to the plot. |
Map.set_text |
Add a text to the map. |
Map.set_topography |
Add topographical shading to the map. |
Input/output¶
get_demo_file |
Returns the path to the desired demo file. |
read_shapefile |
Reads a shapefile using geopandas. |
read_shapefile_to_grid |
Same as read_shapefile but directly transformed to a grid. |
xarray¶
open_xr_dataset |
Thin wrapper around xarray’s open_dataset. |
open_wrf_dataset |
Wrapper around xarray’s open_dataset to make WRF files a bit better. |
xarray accessors¶
Salem adds accessors to xarray objects. They can be accessed via the
.salem
attribute and add the following methods:
DataArray¶
DataArrayAccessor.subset |
Get a subset of the dataset. |
DataArrayAccessor.roi |
Make a region of interest (ROI) for the dataset. |
DataArrayAccessor.transform |
Reprojects an other Dataset or DataArray onto this grid. |
DataArrayAccessor.cartopy |
Get a cartopy.crs.Projection for this dataset. |
DataArrayAccessor.get_map |
Make a salem.Map out of the dataset. |
DataArrayAccessor.quick_map |
Make a plot of the DataArray. |
DataArrayAccessor.interpz |
Interpolates the array along the vertical dimension |
Dataset¶
DatasetAccessor.subset |
Get a subset of the dataset. |
DatasetAccessor.roi |
Make a region of interest (ROI) for the dataset. |
DatasetAccessor.transform |
Reprojects an other Dataset or DataArray onto this grid. |
DatasetAccessor.transform_and_add |
Reprojects an other Dataset and adds it’s content to the current one. |
DatasetAccessor.cartopy |
Get a cartopy.crs.Projection for this dataset. |
DatasetAccessor.get_map |
Make a salem.Map out of the dataset. |
DatasetAccessor.quick_map |
Make a plot of a variable of the DataSet. |
DatasetAccessor.wrf_zlevel |
Interpolates to a specified height above sea level. |
DatasetAccessor.wrf_plevel |
Interpolates to a specified pressure level (hPa). |
Old-style datasets¶
Old-style Datasets (prior to xarray), kept for backwards compatibility reasons and because they are quite lightweight. They might be replaced by xarray’s datasets one day.
GeoDataset |
Interface for georeferenced datasets. |
GeoTiff |
Geolocalised tiff images (needs rasterio). |
GeoNetcdf |
NetCDF files with geolocalisation info. |
WRF |
WRF proof-of-concept template. |
GoogleCenterMap |
Google static map centered on a point. |
GoogleVisibleMap |
Google static map automatically sized and zoomed to a selected region. |
Other¶
geogrid_simulator |
Emulates geogrid.exe, which is useful when defining new WRF domains. |