3838path_root = Path (__file__ ).parents [1 ]
3939sys .path .append (str (path_root ))
4040
41- from scripts_common import get_provenance_metadata , md5sum
41+ from scripts_common import get_provenance_metadata
4242
4343# Define a small constant to initialize the iteration and prevent numerical issues
4444epsilon = 0.001
@@ -91,18 +91,8 @@ def generate_vertical_grid(H, dzd, min_dz, depfac, output_filename):
9191 : len (real_prop_z )
9292 ] # Trim the spacing values to match the adjusted depth levels
9393
94- this_file = os .path .normpath (__file__ )
95-
96- # Add some info about how the file was generated
97- runcmd = (
98- f"python3 { os .path .basename (this_file )} --H={ H } --depfac={ depfac } "
99- f"--dzd={ dzd } "
100- f"--min_dz={ min_dz } "
101- f"--output={ output_filename } "
102- )
103-
10494 # Write to NetCDF file
105- write_netcdf_file (output_filename , real_prop_z , this_file , runcmd )
95+ write_netcdf_file (output_filename , real_prop_z )
10696
10797 print (
10898 f"SUCCESS! A vertical grid with { len (real_prop_z ) - 1 } levels has been generated. "
@@ -111,7 +101,7 @@ def generate_vertical_grid(H, dzd, min_dz, depfac, output_filename):
111101 )
112102
113103
114- def write_netcdf_file (output_filename , real_prop_z , this_file , runcmd ):
104+ def write_netcdf_file (output_filename , real_prop_z ):
115105 """Function to write vertical grid data to a NetCDF file."""
116106 # Convert to float32 (single precision) to ensure values are exactly representable in single precision,
117107 # then convert back to float64 (double precision) for storage in NetCDF.
@@ -125,7 +115,7 @@ def write_netcdf_file(output_filename, real_prop_z, this_file, runcmd):
125115 zeta .standard_name = "depth"
126116 zeta .long_name = "vertical grid depth at top and bottom of each cell"
127117 eddyfile .variables ["zeta" ][:] = real_prop_z_float64
128- eddyfile .setncatts ({ "history" : get_provenance_metadata (this_file , runcmd )})
118+ eddyfile .setncatts (get_provenance_metadata ()) # Obtain metadata
129119 eddyfile .close ()
130120
131121
0 commit comments