Skip to content

Metadata_and_Geometry

Carles Tena edited this page Oct 6, 2026 · 3 revisions

Metadata and geometry

Table of Contents


Time and vertical metadata

sel_time(timestamp, inplace=True) selects a single datetime value from loaded data. Use inplace=False for a separate object. For broader selections see the selection tutorial.

set_climatology(True) marks a climatological dataset; get_climatology() reads the flag. set_time_resolution accepts second(s), minute(s), hour(s) and day(s). These setters describe metadata; they do not resample the data.

set_level_direction("up") or "down" sets the vertical positive attribute. reverse_level_direction() toggles that attribute; it does not reverse the order of levels or data.

Use set_time, set_levels and set_time_bnds to supply time/level coordinates and bounds. Coordinate metadata must remain consistent with the variable dimensions.

Geometry workflows

create_spatial_bounds() derives grid-cell coordinate bounds. create_shapefile() builds the grid geostructure in memory; to_shapefile(path, time=..., lev=..., var_list=...) exports selected data, while write_shapefile(path) writes the stored geostructure. Point datasets do not support polygon spatial bounds; their geostructure uses point geometry.

add_variables_to_shapefile(var_list, idx_lev=0, idx_time=0) adds loaded variable values for a selected level and timestep. get_centroids_from_coordinates() obtains cell centre coordinates.

get_bbox() returns the local extent and get_full_bbox(only_master=False) the full extent, in (min_lon, min_lat, max_lon, max_lat) order and native longitude convention. Bounds are generated if absent. Call the full-grid operation on all MPI ranks.

calculate_grid_area(overwrite=True) stores grid-cell measures. The top-level calculate_geometry_area(geometry_list, ...) computes areas of supplied polygon geometries, with configurable Earth radii. See geospatial tutorials and gridarea CLI.

Clone this wiki locally