This section introduces the concepts of spaces, coordinates and domains.
TLDR
Motivating Examples:
xarray.Dataset
- coordinates & Values - Documentationgeopandas.GeoSeries
- - Documentationrasterio
- Polygons, Rasters
Spaces¶
- Lines - Temporal Plane
- Cartesian - Spatial Plane
- Spherical - Global
- Infinite...
space: Space = Line()
space: Space = Cartesian()
space: Space = Spherical()
Examples:
Example: Time Series
Example: Gulfstream
Example: Earth
Domains¶
In almost all cases in geoscience, we can take the Earth as the domain where all the geophysical quantities lie. If we were to think about Cartesian coordinate system and the Earth, we could assume that the center of the earth is the origin of the domain and the values are bounded between 0 and the radius of the Earth, e.g. ~6,371 km (perhaps a bit further into space if we account for the atmosphere). We can also think about it in spherical terms which bounds the domain in terms of how many rotations, e.g. . We can even be interested in subregions along the globe like the Mediterranean sea or the open ocean. For the spatial domain, we define as proper subset of the entire domain . For the temporal domain, , it is usually defined along a bounded number line . However, we could also use the 24 hour clock as well as cyclic calendars with years, months and days. So more concretely, we define our coordinate system where our quantities of interest lie as
There are of course simplifications to this system. For example, we could be looking for processes that stationary (don’t change in time) or constant (don’t change in space). However, both are sub-cases and are still covered within this notation!
Analogous to Regions & Periods
Example: xarray.Dataset
# selecting time (GulfStream)
xarray.Dataset.sel(lon=slice(-65, -55), lat=slice(33, 43))
# selecting period (This Year)
xarray.Dataset.sel(time=slice("2023-01", "2023-08"))
Coordinates¶
x, y = space.coords
X, Y = space.grid
Examples:
Coordinate Reference Systems¶
Examples¶
Code Formulation
One example of a domain on a line
t_min: float = 0.0
t_max: float = 1.0
type: str = "line"
time_domain: obj = Domain(bounds=(t_min, t_max))
Perhaps we could sample from this domain (infinitely)
samples: Array["inf"] = time_domain.sample(inf)
Now the minimum and maximum of these samples would be between . This would be nearly equivalent with a vector of spatial coordinates along a line.
2D Space Domain
So let's assume we have a 2D domain that's defined on Euclidean space.
x_space: object = Domain((x_min, x_max))
y_space: object = Domain((y_min, y_max))
Now we want to create an object
xy_domain: object = Domain((x_domain, y_domain))
Example: Sea Surface Height
For sea surface height, it can exist on the surface of a sphere (roughly). This has the spatial coordinates as latitude, longitude and we can set some arbitrary temporal some coordinates as days.
We can also transform these coordinates into an x,y plane with a higher frequency. For example, we can use the local tangent coordinate system defined over the Gulfstream where SSH is queried every hour.
This is typically what we do in numerical schemes as it can be quite difficult to march along the entire globe, especially at finer resolutions (see my discussion on discretization).