|
5 | 5 | """
|
6 | 6 |
|
7 | 7 |
|
8 |
| -import copy |
9 | 8 | import re
|
10 | 9 | from typing import MutableMapping, Tuple
|
11 | 10 |
|
12 | 11 | coordinate_criteria: MutableMapping[str, MutableMapping[str, Tuple]] = {
|
13 |
| - "standard_name": { |
14 |
| - "X": ("projection_x_coordinate",), |
15 |
| - "Y": ("projection_y_coordinate",), |
16 |
| - "T": ("time",), |
17 |
| - "time": ("time",), |
18 |
| - "vertical": ( |
19 |
| - "air_pressure", |
20 |
| - "height", |
21 |
| - "depth", |
22 |
| - "geopotential_height", |
23 |
| - # computed dimensional coordinate name |
24 |
| - "altitude", |
25 |
| - "height_above_geopotential_datum", |
26 |
| - "height_above_reference_ellipsoid", |
27 |
| - "height_above_mean_sea_level", |
| 12 | + "latitude": { |
| 13 | + "standard_name": ("latitude",), |
| 14 | + "units": ( |
| 15 | + "degree_north", |
| 16 | + "degree_N", |
| 17 | + "degreeN", |
| 18 | + "degrees_north", |
| 19 | + "degrees_N", |
| 20 | + "degreesN", |
28 | 21 | ),
|
29 |
| - "Z": ( |
| 22 | + "_CoordinateAxisType": ("Lat",), |
| 23 | + }, |
| 24 | + "longitude": { |
| 25 | + "standard_name": ("longitude",), |
| 26 | + "units": ( |
| 27 | + "degree_east", |
| 28 | + "degree_E", |
| 29 | + "degreeE", |
| 30 | + "degrees_east", |
| 31 | + "degrees_E", |
| 32 | + "degreesE", |
| 33 | + ), |
| 34 | + "_CoordinateAxisType": ("Lon",), |
| 35 | + }, |
| 36 | + "Z": { |
| 37 | + "standard_name": ( |
30 | 38 | "model_level_number",
|
31 | 39 | "atmosphere_ln_pressure_coordinate",
|
32 | 40 | "atmosphere_sigma_coordinate",
|
|
40 | 48 | "ocean_sigma_z_coordinate",
|
41 | 49 | "ocean_double_sigma_coordinate",
|
42 | 50 | ),
|
43 |
| - "latitude": ("latitude",), |
44 |
| - "longitude": ("longitude",), |
45 |
| - }, |
46 |
| - "_CoordinateAxisType": { |
47 |
| - "T": ("Time",), |
48 |
| - "Z": ("GeoZ", "Height", "Pressure"), |
49 |
| - "Y": ("GeoY",), |
50 |
| - "latitude": ("Lat",), |
51 |
| - "X": ("GeoX",), |
52 |
| - "longitude": ("Lon",), |
53 |
| - }, |
54 |
| - "axis": {"T": ("T",), "Z": ("Z",), "Y": ("Y",), "X": ("X",)}, |
55 |
| - "cartesian_axis": {"T": ("T",), "Z": ("Z",), "Y": ("Y",), "X": ("X",)}, |
56 |
| - "positive": {"vertical": ("up", "down")}, |
57 |
| - "units": { |
58 |
| - "latitude": ( |
59 |
| - "degree_north", |
60 |
| - "degree_N", |
61 |
| - "degreeN", |
62 |
| - "degrees_north", |
63 |
| - "degrees_N", |
64 |
| - "degreesN", |
| 51 | + "_CoordinateAxisType": ( |
| 52 | + "GeoZ", |
| 53 | + "Height", |
| 54 | + "Pressure", |
65 | 55 | ),
|
66 |
| - "longitude": ( |
67 |
| - "degree_east", |
68 |
| - "degree_E", |
69 |
| - "degreeE", |
70 |
| - "degrees_east", |
71 |
| - "degrees_E", |
72 |
| - "degreesE", |
| 56 | + "axis": ("Z",), |
| 57 | + }, |
| 58 | + "vertical": { |
| 59 | + "standard_name": ( |
| 60 | + "air_pressure", |
| 61 | + "height", |
| 62 | + "depth", |
| 63 | + "geopotential_height", |
| 64 | + # computed dimensional coordinate name |
| 65 | + "altitude", |
| 66 | + "height_above_geopotential_datum", |
| 67 | + "height_above_reference_ellipsoid", |
| 68 | + "height_above_mean_sea_level", |
73 | 69 | ),
|
| 70 | + "positive": ("up", "down"), |
| 71 | + }, |
| 72 | + "X": { |
| 73 | + "standard_name": ("projection_x_coordinate",), |
| 74 | + "_CoordinateAxisType": ("GeoX",), |
| 75 | + "axis": ("X",), |
| 76 | + }, |
| 77 | + "Y": { |
| 78 | + "standard_name": ("projection_y_coordinate",), |
| 79 | + "_CoordinateAxisType": ("GeoY",), |
| 80 | + "axis": ("Y",), |
| 81 | + }, |
| 82 | + "T": {"standard_name": ("time",), "_CoordinateAxisType": ("Time",), "axis": ("T",)}, |
| 83 | + "time": { |
| 84 | + "standard_name": ("time",), |
74 | 85 | },
|
75 | 86 | }
|
76 | 87 |
|
77 | 88 | # "long_name" and "standard_name" criteria are the same. For convenience.
|
78 |
| -coordinate_criteria["long_name"] = copy.deepcopy(coordinate_criteria["standard_name"]) |
79 |
| -coordinate_criteria["long_name"]["X"] += ("cell index along first dimension",) |
80 |
| -coordinate_criteria["long_name"]["Y"] += ("cell index along second dimension",) |
| 89 | +for coord, attrs in coordinate_criteria.items(): |
| 90 | + coordinate_criteria[coord]["long_name"] = coordinate_criteria[coord][ |
| 91 | + "standard_name" |
| 92 | + ] |
| 93 | +coordinate_criteria["X"]["long_name"] += ("cell index along first dimension",) |
| 94 | +coordinate_criteria["Y"]["long_name"] += ("cell index along second dimension",) |
| 95 | + |
81 | 96 |
|
82 | 97 | #: regular expressions for guess_coord_axis
|
83 | 98 | regex = {
|
|
0 commit comments