Data handling

For ClimCanvas v1.02.1

This chapter explains which coordinates ClimCanvas treats as latitude, longitude, vertical and time after a netCDF file is loaded, which dimensions are fixed, and which range is plotted. For the file-loading operation itself, see Basic operation. The numerical conventions for selection, cropping, averaging and missing values are listed in Computational conventions.

Coordinates and dimensions

In netCDF, a "dimension" and a "coordinate variable" are different things. ClimCanvas treats xarray's coordinate variables as coordinates and its dimensions as dimensions; the usual form is that the two correspond under the same name. Coordinate values are taken as they are in the array, so they need not be evenly spaced.

Dimensions without a coordinate variable (bare dims) are shown in "File info" as "Dims without coordinate variables (bare dims)" and are handled as follows.

When several files are loaded, the dimension names of the first file (ds0) are taken as the reference, and dimensions with the same role in the other files (for example latitude and lat) are renamed to match. Only the names are aligned; the coordinate values are not compared.

Auto-detection of coordinate roles

On loading, each coordinate variable is tested for the roles latitude (lat) / longitude (lon) / vertical (vertical) / time (time). The test is applied to each coordinate variable in the order time → latitude → longitude → vertical, and a role is adopted as soon as any one of its conditions holds. When several coordinates match the same role, only the first one found is used.

Role Condition (any of)
Time The values are datetime (datetime64), standard_name is time, axis is T, the name is time / times / date / year
Latitude standard_name is latitude, units is of the degrees_north kind, axis is Y, the name is lat / latitude / ylat / nav_lat
Longitude standard_name is longitude, units is of the degrees_east kind, axis is X, the name is lon / longitude / xlon / nav_lon
Vertical axis is Z, a positive attribute exists, the name is lev / level / plev / pres / pressure / height / altitude / depth / isobaric etc., or units is hPa / Pa / mb / m / km and the name is not a latitude or longitude

Names and attributes are compared case-insensitively. The result appears under "Auto-detected coordinates (ds0)" in "File info". A role that could not be detected becomes "(none)", and the plot modes that use that role disappear from the choices.

Plot mode Condition for appearing
Horizontal map The latitude and longitude roles exist (or track data with longitude and latitude variables)
Vertical cross-section The vertical role and either the latitude or the longitude role exist (on a 2-D coordinate grid: sections along grid rows / columns, parallels, meridians and great circles)
Time section The time role and one of the vertical, latitude or longitude roles exist. Not available on a 2-D coordinate grid
1-D plot At least one dimension has a coordinate variable
1-D plot (aggregation), 2-D plot (aggregation) A numeric variable without latitude or longitude among its dimensions exists (station data, etc.)
2-D plot At least one data variable exists

When no mode can be offered, the app stops with "No drawable combination of coordinates found." Most failures to assign a role are due to variable names and attributes. The reliable fix is to correct the coordinate names or units in the file; only time can be specified inside the app, as described in the next section.

Dimension to treat as time

"Dimension to treat as time" in "File info" lets you give the time role to a numeric dimension that is not detected as time automatically (such as the lag axis of a lag correlation). The choices are the 1-D dimensions with coordinate variables in the first file; the default is "(follow auto-detection)".

2-D coordinates (curvilinear grid)

Data whose latitude and longitude are both 2-D (for example lat(y, x), lon(y, x)) with the same two dimensions are treated as a 2-D coordinate grid. The Lambert grids of regional models and the grids of ocean models fall into this category. When the longitude and latitude are in separate files, attach them with coordinate files.

What is not available on a 2-D coordinate grid

Time sections (sections with latitude or longitude as an axis), range means over latitude or longitude, and adding a cyclic point in longitude are not available. Vector components are taken as eastward and northward (they are not rotated into grid-aligned components). An error occurs when grid cells whose longitude or latitude is NaN (land cells of ocean models, etc.) fall inside the plotted region.

Fixing dimensions

The dimensions other than the two (or one) being plotted are either fixed at a single value or averaged over a range. Fixing happens at two levels: the panel and the layer.

Level Target Where
Panel Time (shared by all layers; stepped by animation) The "Time" section of the sidebar
Layer Vertical level, latitude, longitude and other dimensions that may differ from layer to layer Inside each layer's settings

When the same dimension is specified at both levels, the layer level takes precedence. The assignment per mode is as follows.

Plot mode Panel level Layer level
Horizontal map Time Vertical level and other dimensions outside the horizontal plane
Vertical cross-section Time The latitude or longitude to fix
Time section None All dimensions not used by the section (latitude and longitude may also be range-averaged)
1-D plot Time (when the x-axis is not time) All dimensions other than the x-axis
2-D plot, aggregation modes None Everything at the layer level (including time)

Contents of the "Time" section.

The Time section
The 'Time' section: buttons to step to the previous / next time, time selection, showing the time, animation.

For fixing at the layer level, in sections and similar plots you can choose "Fixed value" or "Range mean" per dimension.

In scatter plots and bubble charts, the dimensions other than the one being drawn are fixed in each layer (the initial value is the middle index). In aggregation layers you choose "Dim to aggregate", and "Set aggregation range" narrows the period or interval.

Specifying ranges

Horizontal map

Ticking "Projection & region" → "Set lat/lon extent" sets the displayed range with "Longitude min", "Longitude max", "Latitude min" and "Latitude max".

Vertical cross-section and time section

1-D plot

Choose the x-axis dimension with "Axes" under "Plot axis", and set the range with the "Range" slider and input fields. The slider and the input fields are linked.

Even when a coordinate is descending (pressure 1000 → 200, latitude 90 → -90, etc.), the range is handled in the order of smaller and larger value. The direction is determined automatically from the coordinate.

Cyclic longitude

Missing values

ClimCanvas does not detect missing values itself. The values that xarray turned into NaN according to the netCDF attributes are passed to matplotlib as they are, and matplotlib skips them.

Declaration in the file Result
_FillValue or missing_value present Becomes NaN and is not drawn
Only valid_range / valid_min / valid_max Drawn as the value is (including values outside the range)
Nothing Drawn as the value is

Time axis and calendars

Time coordinates are handled as follows on loading. The calendar is determined by the file's calendar attribute.

Calendar Handling
standard / gregorian / proleptic_gregorian / noleap (365_day) Converted to datetime (datetime64). The date format option is available
360_day / all_leap (366_day) Turned into a numeric axis of consecutive days from the starting year (unit: day)
Years of the above that cannot be represented as datetime (dummy times in year 0000, paleoclimate data) Turned into a numeric axis of days elapsed from the first time