Skip to content

Commit f14e890

Browse files
authored
Resolve issues: #24, #64, #82, #118, other fixes (#148)
## Description Resolving several open issues and items noted on previous PRs: - Fix #24 - Renaming "vertical_layer_dimension" to just "vertical_dimension" for consistency with other dimension names - Add a definition of "interface" for clarity - Fix #64 - Replacing the use of "volumetric" with "volume_fraction" where appropriate - Resolve #82 - Changed all mentions of "sea level" to "mean sea level" for clarity and consistency with CF standard names - Finish fixing #118 - Changing the remaining format statements to f-strings - Other fixes - Updating github action versions per comments on #145 - More appropriate error types for exceptions raised in `tools/lib/xml_tools.py` - Remove @mwaxmonsky and @mattldawson from CODEOWNERS ## Issues Resolves #24, #64, #82, #118
1 parent 14540ff commit f14e890

8 files changed

Lines changed: 71 additions & 76 deletions

.github/workflows/pull_request_ci.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ jobs:
1313
runs-on: ubuntu-latest
1414
steps:
1515
- name: Checkout repository
16-
uses: actions/checkout@v4
16+
uses: actions/checkout@v6
1717

1818
- name: Setup Python
19-
uses: actions/setup-python@v4
19+
uses: actions/setup-python@v5
2020
with:
2121
python-version: "3.x"
2222

@@ -34,7 +34,7 @@ jobs:
3434
runs-on: ubuntu-latest
3535
steps:
3636
- name: Checkout repository
37-
uses: actions/checkout@v4
37+
uses: actions/checkout@v6
3838

3939
- name: Install dependencies
4040
run: |
@@ -50,10 +50,10 @@ jobs:
5050
runs-on: ubuntu-latest
5151
steps:
5252
- name: Checkout repository
53-
uses: actions/checkout@v4
53+
uses: actions/checkout@v6
5454

5555
- name: Setup Python
56-
uses: actions/setup-python@v4
56+
uses: actions/setup-python@v5
5757
with:
5858
python-version: "3.x"
5959

@@ -74,10 +74,10 @@ jobs:
7474

7575
steps:
7676
- name: Checkout repository
77-
uses: actions/checkout@v4
77+
uses: actions/checkout@v6
7878

7979
- name: Setup Python
80-
uses: actions/setup-python@v4
80+
uses: actions/setup-python@v5
8181
with:
8282
python-version: "3.x"
8383

@@ -95,10 +95,10 @@ jobs:
9595
runs-on: ubuntu-latest
9696
steps:
9797
- name: Checkout repository
98-
uses: actions/checkout@v4
98+
uses: actions/checkout@v6
9999

100100
- name: Setup Python
101-
uses: actions/setup-python@v4
101+
uses: actions/setup-python@v5
102102
with:
103103
python-version: "3.x"
104104

CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
# These owners will be the default owners for everything in the repo.
55

6-
* @cacraigucar @climbfuji @dustinswales @grantfirl @mattldawson @mkavulich @mwaxmonsky @nusbaume @peverwhee @MarekWlasak @svahl991 @ss421
6+
* @cacraigucar @climbfuji @dustinswales @grantfirl @mkavulich @nusbaume @peverwhee @MarekWlasak @svahl991 @ss421
77

88
# Order is important. The last matching pattern has the most precedence.
99
# So if a pull request only touches javascript files, only these owners

Metadata-standard-names.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -286,8 +286,14 @@ Names indicating the size, extent, or bounds of data structures in a model.
286286
* `real`: units = 1
287287
* `upper_bound_of_vertical_dimension_of_surface_snow`: upper bound of of snow-related arrays for land surface model
288288
* `integer`: units = count
289+
* `vertical_dimension`: number of vertical layers
290+
* `integer`: units = count
291+
* `vertical_dimension_extended_up_by_1`: number of vertical layers extended up by 1
292+
* `integer`: units = count
289293
* `vertical_dimension_for_radiation`: Vertical dimension for radiation
290294
* `integer`: units = count
295+
* `vertical_dimension_minus_one`: Vertical dimension minus one
296+
* `integer`: units = count
291297
* `vertical_dimension_of_sea_ice`: Vertical dimension of sea ice
292298
* `integer`: units = count
293299
* `vertical_dimension_of_soil`: Vertical dimension of soil
@@ -302,12 +308,6 @@ Names indicating the size, extent, or bounds of data structures in a model.
302308
* `integer`: units = count
303309
* `vertical_interface_dimension_interstitial`: Vertical interface dimension interstitial
304310
* `integer`: units = count
305-
* `vertical_layer_dimension`: number of vertical layers
306-
* `integer`: units = count
307-
* `vertical_layer_dimension_extended_up_by_1`: number of vertical layers extended up by 1
308-
* `integer`: units = count
309-
* `vertical_layer_dimension_minus_one`: Vertical layer dimension minus one
310-
* `integer`: units = count
311311
## Constants
312312
Constant parameters that should be identical across a full modeling system
313313
* `avogadro_number`: Avogadro number
@@ -398,7 +398,7 @@ Variables defining or relating to timing, dates, calendar, and related concepts
398398
* `real`: units = Pa
399399
* `air_pressure_at_lowest_model_interface`: Air pressure at lowest model interface
400400
* `real`: units = Pa
401-
* `air_pressure_at_sea_level`: Air pressure at sea level
401+
* `air_pressure_at_mean_sea_level`: Air pressure at mean sea level
402402
* Equivalent CF name: `air_pressure_at_mean_sea_level`
403403
* `real`: units = Pa
404404
* `air_pressure_at_surface`: Air pressure at local surface
@@ -579,7 +579,7 @@ Variables defining or relating to timing, dates, calendar, and related concepts
579579
* `upward_heat_flux_in_air_at_surface`: Upward heat flux in air at surface
580580
* Equivalent CF name: `surface_upward_heat_flux_in_air`
581581
* `real`: units = W m-2
582-
* `us_standard_air_pressure_at_sea_level`: US Standard Atmospheric pressure at sea level
582+
* `us_standard_air_pressure_at_mean_sea_level`: US Standard Atmospheric pressure at sea level
583583
* `real`: units = Pa
584584
* `variance_of_air_temperature`: Variance of air temperature
585585
* `real`: units = K2
@@ -2434,6 +2434,8 @@ Thresholds represent some value at which the behavior of some process changes, i
24342434
* `volume_fraction_of_condensed_water_in_soil`: Volume fraction of condensed water in soil
24352435
* Equivalent CF name: `volume_fraction_of_condensed_water_in_soil`
24362436
* `real`: units = fraction
2437+
* `volume_fraction_of_equilibrium_soil_moisture`: Volume fraction of equilibrium soil moisture
2438+
* `real`: units = fraction
24372439
* `volume_fraction_of_frozen_soil_moisture_for_lsm`: Volume fraction of frozen soil moisture for land surface model
24382440
* `real`: units = fraction
24392441
* `volume_fraction_of_liquid_water_in_soil_at_critical_point`: volume fraction of water in liquid phase in soil at critical point
@@ -2442,16 +2444,14 @@ Thresholds represent some value at which the behavior of some process changes, i
24422444
* `real`: units = m3 m-3
24432445
* `volume_fraction_of_liquid_water_in_soil_at_wilting_point`: volume fraction of water in liquid phase in soil at wilting point
24442446
* `real`: units = m3 m-3
2447+
* `volume_fraction_of_soil_moisture_between_soil_bottom_and_water_table`: Volume fraction of soil moisture between soil bottom and water table
2448+
* `real`: units = fraction
24452449
* `volume_fraction_of_soil_moisture_for_lsm`: Volume fraction of soil moisture for land surface model
24462450
* `real`: units = fraction
24472451
* `volume_fraction_of_unfrozen_soil_moisture_for_lsm`: Volume fraction of unfrozen soil moisture for land surface model
24482452
* `real`: units = fraction
24492453
* `volume_fraction_of_unfrozen_water_in_soil`: Volume fraction of unfrozen water in soil
24502454
* `real`: units = fraction
2451-
* `volumetric_equilibrium_soil_moisture`: Volumetric equilibrium soil moisture
2452-
* `real`: units = m3 m-3
2453-
* `volumetric_soil_moisture_between_soil_bottom_and_water_table`: Volumetric soil moisture between soil bottom and water table
2454-
* `real`: units = m3 m-3
24552455
* `water_storage_in_aquifer`: Water storage in aquifer
24562456
* `real`: units = mm
24572457
* `water_storage_in_aquifer_and_saturated_soil`: Water storage in aquifer and saturated soil

Metadata-standard-names.yaml

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -536,10 +536,22 @@ section:
536536
description: upper bound of of snow-related arrays for land surface model
537537
type: integer
538538
units: count
539+
- name: vertical_dimension
540+
description: number of vertical layers
541+
type: integer
542+
units: count
543+
- name: vertical_dimension_extended_up_by_1
544+
description: number of vertical layers extended up by 1
545+
type: integer
546+
units: count
539547
- name: vertical_dimension_for_radiation
540548
description: Vertical dimension for radiation
541549
type: integer
542550
units: count
551+
- name: vertical_dimension_minus_one
552+
description: Vertical dimension minus one
553+
type: integer
554+
units: count
543555
- name: vertical_dimension_of_sea_ice
544556
description: Vertical dimension of sea ice
545557
type: integer
@@ -568,18 +580,6 @@ section:
568580
description: Vertical interface dimension interstitial
569581
type: integer
570582
units: count
571-
- name: vertical_layer_dimension
572-
description: number of vertical layers
573-
type: integer
574-
units: count
575-
- name: vertical_layer_dimension_extended_up_by_1
576-
description: number of vertical layers extended up by 1
577-
type: integer
578-
units: count
579-
- name: vertical_layer_dimension_minus_one
580-
description: Vertical layer dimension minus one
581-
type: integer
582-
units: count
583583
- name: Constants
584584
comment: Constant parameters that should be identical across a full modeling system
585585
standard_names:
@@ -758,9 +758,9 @@ section:
758758
description: Air pressure at lowest model interface
759759
type: real
760760
units: Pa
761-
- name: air_pressure_at_sea_level
761+
- name: air_pressure_at_mean_sea_level
762762
cfname: air_pressure_at_mean_sea_level
763-
description: Air pressure at sea level
763+
description: Air pressure at mean sea level
764764
type: real
765765
units: Pa
766766
- name: air_pressure_at_surface
@@ -1121,7 +1121,7 @@ section:
11211121
description: Upward heat flux in air at surface
11221122
type: real
11231123
units: W m-2
1124-
- name: us_standard_air_pressure_at_sea_level
1124+
- name: us_standard_air_pressure_at_mean_sea_level
11251125
description: US Standard Atmospheric pressure at sea level
11261126
type: real
11271127
units: Pa
@@ -5049,6 +5049,10 @@ section:
50495049
description: Volume fraction of condensed water in soil
50505050
type: real
50515051
units: fraction
5052+
- name: volume_fraction_of_equilibrium_soil_moisture
5053+
description: Volume fraction of equilibrium soil moisture
5054+
type: real
5055+
units: fraction
50525056
- name: volume_fraction_of_frozen_soil_moisture_for_lsm
50535057
description: Volume fraction of frozen soil moisture for land surface model
50545058
type: real
@@ -5065,6 +5069,10 @@ section:
50655069
description: volume fraction of water in liquid phase in soil at wilting point
50665070
type: real
50675071
units: m3 m-3
5072+
- name: volume_fraction_of_soil_moisture_between_soil_bottom_and_water_table
5073+
description: Volume fraction of soil moisture between soil bottom and water table
5074+
type: real
5075+
units: fraction
50685076
- name: volume_fraction_of_soil_moisture_for_lsm
50695077
description: Volume fraction of soil moisture for land surface model
50705078
type: real
@@ -5077,14 +5085,6 @@ section:
50775085
description: Volume fraction of unfrozen water in soil
50785086
type: real
50795087
units: fraction
5080-
- name: volumetric_equilibrium_soil_moisture
5081-
description: Volumetric equilibrium soil moisture
5082-
type: real
5083-
units: m3 m-3
5084-
- name: volumetric_soil_moisture_between_soil_bottom_and_water_table
5085-
description: Volumetric soil moisture between soil bottom and water table
5086-
type: real
5087-
units: m3 m-3
50885088
- name: water_storage_in_aquifer
50895089
description: Water storage in aquifer
50905090
type: real

StandardNamesRules.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,8 @@ Special phrases
544544
+------------------------+-------------------------------------------------------------------------------------+
545545
| frozen_water | ice |
546546
+------------------------+-------------------------------------------------------------------------------------+
547+
| interface | The vertical boundary of a model layer. |
548+
+------------------------+-------------------------------------------------------------------------------------+
547549
| longwave | Longwave radiation. Defined as thermal emission of radiation from the planet. |
548550
+------------------------+-------------------------------------------------------------------------------------+
549551
| moisture | water in all phases contained in soil |

standard_names.xml

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -401,9 +401,18 @@
401401
<standard_name name="upper_bound_of_vertical_dimension_of_surface_snow" description="upper bound of of snow-related arrays for land surface model">
402402
<type units="count">integer</type>
403403
</standard_name>
404+
<standard_name name="vertical_dimension" description="number of vertical layers">
405+
<type units="count">integer</type>
406+
</standard_name>
407+
<standard_name name="vertical_dimension_extended_up_by_1" description="number of vertical layers extended up by 1">
408+
<type units="count">integer</type>
409+
</standard_name>
404410
<standard_name name="vertical_dimension_for_radiation">
405411
<type units="count">integer</type>
406412
</standard_name>
413+
<standard_name name="vertical_dimension_minus_one">
414+
<type units="count">integer</type>
415+
</standard_name>
407416
<standard_name name="vertical_dimension_of_sea_ice">
408417
<type units="count">integer</type>
409418
</standard_name>
@@ -425,15 +434,6 @@
425434
<standard_name name="vertical_interface_dimension_interstitial">
426435
<type units="count">integer</type>
427436
</standard_name>
428-
<standard_name name="vertical_layer_dimension" description="number of vertical layers">
429-
<type units="count">integer</type>
430-
</standard_name>
431-
<standard_name name="vertical_layer_dimension_extended_up_by_1" description="number of vertical layers extended up by 1">
432-
<type units="count">integer</type>
433-
</standard_name>
434-
<standard_name name="vertical_layer_dimension_minus_one">
435-
<type units="count">integer</type>
436-
</standard_name>
437437
</section>
438438
<section name="Constants" comment="Constant parameters that should be identical across a full modeling system">
439439
<standard_name name="avogadro_number">
@@ -564,7 +564,7 @@
564564
<standard_name name="air_pressure_at_lowest_model_interface">
565565
<type units="Pa">real</type>
566566
</standard_name>
567-
<standard_name name="air_pressure_at_sea_level">
567+
<standard_name name="air_pressure_at_mean_sea_level">
568568
<cfname>air_pressure_at_mean_sea_level</cfname>
569569
<type units="Pa">real</type>
570570
</standard_name>
@@ -829,7 +829,7 @@
829829
<cfname>surface_upward_heat_flux_in_air</cfname>
830830
<type units="W m-2">real</type>
831831
</standard_name>
832-
<standard_name name="us_standard_air_pressure_at_sea_level" description="US Standard Atmospheric pressure at sea level">
832+
<standard_name name="us_standard_air_pressure_at_mean_sea_level" description="US Standard Atmospheric pressure at sea level">
833833
<type units="Pa">real</type>
834834
</standard_name>
835835
<standard_name name="variance_of_air_temperature">
@@ -3588,6 +3588,9 @@
35883588
<cfname>volume_fraction_of_condensed_water_in_soil</cfname>
35893589
<type units="fraction">real</type>
35903590
</standard_name>
3591+
<standard_name name="volume_fraction_of_equilibrium_soil_moisture">
3592+
<type units="fraction">real</type>
3593+
</standard_name>
35913594
<standard_name name="volume_fraction_of_frozen_soil_moisture_for_lsm" description="Volume fraction of frozen soil moisture for land surface model">
35923595
<type units="fraction">real</type>
35933596
</standard_name>
@@ -3600,6 +3603,9 @@
36003603
<standard_name name="volume_fraction_of_liquid_water_in_soil_at_wilting_point" description="volume fraction of water in liquid phase in soil at wilting point">
36013604
<type units="m3 m-3">real</type>
36023605
</standard_name>
3606+
<standard_name name="volume_fraction_of_soil_moisture_between_soil_bottom_and_water_table">
3607+
<type units="fraction">real</type>
3608+
</standard_name>
36033609
<standard_name name="volume_fraction_of_soil_moisture_for_lsm" description="Volume fraction of soil moisture for land surface model">
36043610
<type units="fraction">real</type>
36053611
</standard_name>
@@ -3609,12 +3615,6 @@
36093615
<standard_name name="volume_fraction_of_unfrozen_water_in_soil">
36103616
<type units="fraction">real</type>
36113617
</standard_name>
3612-
<standard_name name="volumetric_equilibrium_soil_moisture">
3613-
<type units="m3 m-3">real</type>
3614-
</standard_name>
3615-
<standard_name name="volumetric_soil_moisture_between_soil_bottom_and_water_table">
3616-
<type units="m3 m-3">real</type>
3617-
</standard_name>
36183618
<standard_name name="water_storage_in_aquifer">
36193619
<type units="mm">real</type>
36203620
</standard_name>

tools/lib/xml_tools.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -64,26 +64,20 @@ def validate_xml_file(filename, schema_file, logger, error_on_noxmllint=False):
6464
"""
6565
# Check the filename
6666
if not os.path.isfile(filename):
67-
raise ValueError(f"validate_xml_file: Filename, '{filename}', does not exist")
68-
if not os.access(filename, os.R_OK):
69-
raise ValueError(f"validate_xml_file: Cannot open '{filename}'")
67+
raise FileNotFoundError(f"validate_xml_file: Filename, '{filename}', does not exist")
7068
if not os.path.isfile(schema_file):
71-
raise ValueError(f"validate_xml_file: Cannot find schema file {schema_file}")
72-
if not os.access(schema_file, os.R_OK):
73-
emsg = "validate_xml_file: Cannot open schema, '{}'"
74-
raise ValueError(emsg.format(schema_file))
69+
raise FileNotFoundError(f"validate_xml_file: Cannot find schema file '{schema_file}' ")
7570
if _XMLLINT is not None:
7671
if logger is not None:
77-
lmsg = "Checking file {} against schema {}"
78-
logger.debug(lmsg.format(filename, schema_file))
72+
logger.debug(f"Checking file {filename} against schema {schema_file}")
7973
cmd = [_XMLLINT, '--noout', '--schema', schema_file, filename]
8074
result = call_command(cmd, logger)
8175
return result
82-
lmsg = "xmllint not found, could not validate file {}"
76+
lmsg = f"xmllint not found, could not validate file {filename}"
8377
if error_on_noxmllint:
84-
raise ValueError("validate_xml_file: " + lmsg.format(filename))
78+
raise ImportError("validate_xml_file: " + lmsg)
8579
if logger is not None:
86-
logger.warning(lmsg.format(filename))
80+
logger.warning(lmsg)
8781
return True # We could not check but still need to proceed
8882

8983
###############################################################################

tools/write_standard_name_table.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,7 @@ def parse_section(snl, sec, level='##'):
148148
units = item.get('units')
149149
snl.write(f' * `{txt}`: units = {units}\n')
150150
else:
151-
emsg = "Unknown standard name property, '{}'"
152-
raise ValueError(emsg.format(item.tag))
151+
raise ValueError(f"Unknown standard name property, '{item.tag}'")
153152

154153

155154
def convert_xml_to_yaml(root, library_name, yaml_file):

0 commit comments

Comments
 (0)