cleopy 0.57.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cleopy/__init__.py +22 -0
- cleopy/cxx2py.py +136 -0
- cleopy/editconfigfile.py +61 -0
- cleopy/gbxboundariesbinary_src/__init__.py +16 -0
- cleopy/gbxboundariesbinary_src/create_gbxboundaries.py +197 -0
- cleopy/gbxboundariesbinary_src/read_gbxboundaries.py +350 -0
- cleopy/geninitconds.py +144 -0
- cleopy/initsuperdropsbinary_src/__init__.py +15 -0
- cleopy/initsuperdropsbinary_src/attrsgen.py +206 -0
- cleopy/initsuperdropsbinary_src/crdgens.py +101 -0
- cleopy/initsuperdropsbinary_src/create_initsuperdrops.py +360 -0
- cleopy/initsuperdropsbinary_src/dryrgens.py +31 -0
- cleopy/initsuperdropsbinary_src/probdists.py +239 -0
- cleopy/initsuperdropsbinary_src/read_initsuperdrops.py +465 -0
- cleopy/initsuperdropsbinary_src/rgens.py +81 -0
- cleopy/readbinary.py +120 -0
- cleopy/readconfigfile.py +61 -0
- cleopy/sdmout_src/__init__.py +16 -0
- cleopy/sdmout_src/massmoms.py +83 -0
- cleopy/sdmout_src/pygbxsdat.py +59 -0
- cleopy/sdmout_src/pysetuptxt.py +90 -0
- cleopy/sdmout_src/pyzarr.py +158 -0
- cleopy/sdmout_src/sdtracing.py +141 -0
- cleopy/sdmout_src/superdrops.py +428 -0
- cleopy/sdmout_src/supersdata.py +228 -0
- cleopy/sdmout_src/thermodata.py +146 -0
- cleopy/sdmout_src/thermoeqns.py +129 -0
- cleopy/sdmout_src/timedata.py +54 -0
- cleopy/thermobinary_src/__init__.py +16 -0
- cleopy/thermobinary_src/create_thermodynamics.py +256 -0
- cleopy/thermobinary_src/read_thermodynamics.py +498 -0
- cleopy/thermobinary_src/thermodyngen.py +56 -0
- cleopy/thermobinary_src/thermogen.py +466 -0
- cleopy/thermobinary_src/windsgen.py +228 -0
- cleopy/writebinary.py +218 -0
- cleopy-0.57.4.dist-info/METADATA +47 -0
- cleopy-0.57.4.dist-info/RECORD +39 -0
- cleopy-0.57.4.dist-info/WHEEL +4 -0
- cleopy-0.57.4.dist-info/licenses/LICENSE.md +43 -0
cleopy/__init__.py
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Copyright (c) 2025 MPI-M, Clara Bayley
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
----- CLEO -----
|
|
6
|
+
File: __init__.py
|
|
7
|
+
Project: cleopy
|
|
8
|
+
Created Date: Tuesday 26th August 2025
|
|
9
|
+
Author: Clara Bayley (CB)
|
|
10
|
+
Additional Contributors:
|
|
11
|
+
-----
|
|
12
|
+
License: BSD 3-Clause "New" or "Revised" License
|
|
13
|
+
https://opensource.org/licenses/BSD-3-Clause
|
|
14
|
+
-----
|
|
15
|
+
File Description:
|
|
16
|
+
"""
|
|
17
|
+
import importlib.metadata
|
|
18
|
+
|
|
19
|
+
try:
|
|
20
|
+
__version__ = importlib.metadata.version(__name__)
|
|
21
|
+
except importlib.metadata.PackageNotFoundError:
|
|
22
|
+
__version__ = "0.0.0" # Fallback for development mode
|
cleopy/cxx2py.py
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Copyright (c) 2024 MPI-M, Clara Bayley
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
----- CLEO -----
|
|
6
|
+
File: cxx2py.py
|
|
7
|
+
Project: cleopy
|
|
8
|
+
Created Date: Friday 13th October 2023
|
|
9
|
+
Author: Clara Bayley (CB)
|
|
10
|
+
Additional Contributors:
|
|
11
|
+
-----
|
|
12
|
+
License: BSD 3-Clause "New" or "Revised" License
|
|
13
|
+
https://opensource.org/licenses/BSD-3-Clause
|
|
14
|
+
-----
|
|
15
|
+
File Description:
|
|
16
|
+
function(s) for converting c++ values into python ones
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def print_dict_statement(filename, dictname, dict):
|
|
21
|
+
"""print key, value pairs for dictionary created by reading filename"""
|
|
22
|
+
|
|
23
|
+
print("\n---- " + dictname + " from ", filename, "-----")
|
|
24
|
+
for c in dict:
|
|
25
|
+
print(c, "=", dict[c])
|
|
26
|
+
print("---------------------------------------------\n")
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def remove_excess_line(line):
|
|
30
|
+
"""removes white spaces and
|
|
31
|
+
and comments from a line"""
|
|
32
|
+
|
|
33
|
+
line = line.strip()
|
|
34
|
+
line = line.replace(" ", "")
|
|
35
|
+
if "#" in line:
|
|
36
|
+
line = line[: line.find("#")]
|
|
37
|
+
|
|
38
|
+
return line
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def line_with_assignment(line):
|
|
42
|
+
"""find all the lines in a file
|
|
43
|
+
which have form [...] = [...] ;
|
|
44
|
+
ie. lines which assign variables. return
|
|
45
|
+
list of these lines truncatd at ;"""
|
|
46
|
+
|
|
47
|
+
line = line.replace(" ", "")
|
|
48
|
+
if "double" in line or "int" in line:
|
|
49
|
+
ind1 = line.find("=")
|
|
50
|
+
ind2 = line.find(";")
|
|
51
|
+
if ind2 != -1 and ind1 != -1 and line[0] != "/":
|
|
52
|
+
goodline = line[: ind2 + 1]
|
|
53
|
+
return goodline
|
|
54
|
+
|
|
55
|
+
else:
|
|
56
|
+
return False
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def where_typename_ends(line):
|
|
60
|
+
"""finds index where c++ name for
|
|
61
|
+
variable type ends for a const double,
|
|
62
|
+
double, int or const int."""
|
|
63
|
+
|
|
64
|
+
if line[:3] == "int":
|
|
65
|
+
x = "int"
|
|
66
|
+
elif line[:6] == "double":
|
|
67
|
+
x = "double"
|
|
68
|
+
elif line[:11] == "constdouble":
|
|
69
|
+
x = "constdouble"
|
|
70
|
+
elif line[:8] == "constint":
|
|
71
|
+
x = "constint"
|
|
72
|
+
elif line[:12] == "constexprint":
|
|
73
|
+
x = "constexprint"
|
|
74
|
+
elif line[:15] == "constexprdouble":
|
|
75
|
+
x = "constexprdouble"
|
|
76
|
+
elif line[:20] == "constexprunsignedint":
|
|
77
|
+
x = "constexprunsignedint"
|
|
78
|
+
elif line[:17] == "constexpruint64_t":
|
|
79
|
+
x = "constexpruint64_t"
|
|
80
|
+
else:
|
|
81
|
+
raise Exception("c++ type for variable not understood")
|
|
82
|
+
return len(x)
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def read_cxxconsts_into_floats(filename):
|
|
86
|
+
"""returns dictionary of value: float from
|
|
87
|
+
(const) doubles and (const) ints
|
|
88
|
+
assigned in a c++ file. Also returns
|
|
89
|
+
dictionary of notfloats for values that
|
|
90
|
+
couldn't be converted"""
|
|
91
|
+
|
|
92
|
+
floats = {}
|
|
93
|
+
notfloats = {}
|
|
94
|
+
with open(filename) as file:
|
|
95
|
+
rlines = []
|
|
96
|
+
filelines = file.readlines()
|
|
97
|
+
for line in filelines:
|
|
98
|
+
goodline = line_with_assignment(line)
|
|
99
|
+
if goodline:
|
|
100
|
+
rlines.append(goodline)
|
|
101
|
+
|
|
102
|
+
for line in rlines:
|
|
103
|
+
x = where_typename_ends(line)
|
|
104
|
+
name = line[x : line.find("=")]
|
|
105
|
+
value = line[line.find("=") + 1 : line.find(";")]
|
|
106
|
+
|
|
107
|
+
try:
|
|
108
|
+
floats[name] = float(value)
|
|
109
|
+
except ValueError:
|
|
110
|
+
notfloats[name] = value
|
|
111
|
+
|
|
112
|
+
return floats
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
def derive_more_floats(consts):
|
|
116
|
+
"""return mconsts dictionary containing
|
|
117
|
+
some derived key,values from values in
|
|
118
|
+
consts dictionary"""
|
|
119
|
+
|
|
120
|
+
mconsts = {
|
|
121
|
+
"COORD0": consts["TIME0"]
|
|
122
|
+
* consts["W0"], # characteristic coordinate grid scale [m]
|
|
123
|
+
"RGAS_DRY": consts["RGAS_UNIV"]
|
|
124
|
+
/ consts["MR_DRY"], # specific gas constant for dry air [J/Kg/K]
|
|
125
|
+
"RGAS_V": consts["RGAS_UNIV"]
|
|
126
|
+
/ consts["MR_WATER"], # specific gas constant for water [J/Kg/K]
|
|
127
|
+
"CP0": consts["CP_DRY"], # characteristic Heat capacity [J/Kg/K]
|
|
128
|
+
"Mr_ratio": consts["MR_WATER"] / consts["MR_DRY"],
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
mconsts["RHO0"] = consts["P0"] / (
|
|
132
|
+
mconsts["CP0"] * consts["TEMP0"]
|
|
133
|
+
) # characteristic density [Kg/m^3]
|
|
134
|
+
mconsts["MASS0"] = (consts["R0"] ** 3) * mconsts["RHO0"] # characteristic mass [Kg]
|
|
135
|
+
|
|
136
|
+
return mconsts
|
cleopy/editconfigfile.py
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Copyright (c) 2025 MPI-M, Clara Bayley
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
----- CLEO -----
|
|
6
|
+
File: editconfigfile.py
|
|
7
|
+
Project: cleopy
|
|
8
|
+
Created Date: Wednesday 17th January 2024
|
|
9
|
+
Author: Clara Bayley (CB)
|
|
10
|
+
Additional Contributors:
|
|
11
|
+
-----
|
|
12
|
+
License: BSD 3-Clause "New" or "Revised" License
|
|
13
|
+
https://opensource.org/licenses/BSD-3-Clause
|
|
14
|
+
-----
|
|
15
|
+
File Description:
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
from ruamel.yaml import YAML
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def update_param(node, param, new_value):
|
|
22
|
+
"""Function to recursively searches for 'param' key in YAML node
|
|
23
|
+
and updates it's value to with 'new_value' when found"""
|
|
24
|
+
|
|
25
|
+
if isinstance(node, dict):
|
|
26
|
+
if param in node:
|
|
27
|
+
node[param] = new_value # update value
|
|
28
|
+
return True
|
|
29
|
+
else:
|
|
30
|
+
for key, val in node.items():
|
|
31
|
+
is_success = update_param(val, param, new_value)
|
|
32
|
+
if is_success:
|
|
33
|
+
return True
|
|
34
|
+
elif isinstance(node, list):
|
|
35
|
+
for item in node:
|
|
36
|
+
is_success = update_param(item, param, new_value)
|
|
37
|
+
if is_success:
|
|
38
|
+
return True
|
|
39
|
+
return False
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def edit_config_params(filename, params2change):
|
|
43
|
+
"""rewrites config YAML file with key,value pairs listed in params2change updated to new values
|
|
44
|
+
whilst preserving original YAML file's formatting and comments etc."""
|
|
45
|
+
|
|
46
|
+
yaml = YAML()
|
|
47
|
+
|
|
48
|
+
# Load the YAML file
|
|
49
|
+
with open(filename, "r") as file:
|
|
50
|
+
data = yaml.load(file)
|
|
51
|
+
|
|
52
|
+
# Update the parameters from the YAML file
|
|
53
|
+
for param, new_value in params2change.items():
|
|
54
|
+
is_success = update_param(data, param, new_value)
|
|
55
|
+
if not is_success:
|
|
56
|
+
errmsg = param + " could not be updated to new value: " + str(new_value)
|
|
57
|
+
raise ValueError(errmsg)
|
|
58
|
+
|
|
59
|
+
# Overwrite the YAML file
|
|
60
|
+
with open(filename, "w") as file:
|
|
61
|
+
yaml.dump(data, file)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Copyright (c) 2025 MPI-M, Clara Bayley
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
----- CLEO -----
|
|
6
|
+
File: __init__.py
|
|
7
|
+
Project: gbxboundariesbinary_src
|
|
8
|
+
Created Date: Tuesday 26th August 2025
|
|
9
|
+
Author: Clara Bayley (CB)
|
|
10
|
+
Additional Contributors:
|
|
11
|
+
-----
|
|
12
|
+
License: BSD 3-Clause "New" or "Revised" License
|
|
13
|
+
https://opensource.org/licenses/BSD-3-Clause
|
|
14
|
+
-----
|
|
15
|
+
File Description:
|
|
16
|
+
"""
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Copyright (c) 2024 MPI-M, Clara Bayley
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
----- CLEO -----
|
|
6
|
+
File: create_gbxboundaries.py
|
|
7
|
+
Project: gbxboundariesbinary_src
|
|
8
|
+
Created Date: Monday 16th October 2023
|
|
9
|
+
Author: Clara Bayley (CB)
|
|
10
|
+
Additional Contributors:
|
|
11
|
+
-----
|
|
12
|
+
License: BSD 3-Clause "New" or "Revised" License
|
|
13
|
+
https://opensource.org/licenses/BSD-3-Clause
|
|
14
|
+
-----
|
|
15
|
+
File Description:
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
import numpy as np
|
|
19
|
+
|
|
20
|
+
from .. import cxx2py, writebinary
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def get_COORD0_from_constsfile(constants_filename, returnconsts=False):
|
|
24
|
+
"""create values from constants file required as inputs to create initial
|
|
25
|
+
superdroplet conditions"""
|
|
26
|
+
|
|
27
|
+
consts = cxx2py.read_cxxconsts_into_floats(constants_filename)
|
|
28
|
+
COORD0 = consts["TIME0"] * consts["W0"]
|
|
29
|
+
|
|
30
|
+
if returnconsts:
|
|
31
|
+
return COORD0, consts
|
|
32
|
+
else:
|
|
33
|
+
return COORD0
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def linearlyspaced_halfcoords(grid):
|
|
37
|
+
"""returns linearly spaced half coords ie. 1D
|
|
38
|
+
gridbox boundaries given 'grid' list of
|
|
39
|
+
[min coord, max coord, delta coord] for x, y or z"""
|
|
40
|
+
|
|
41
|
+
min, max, delta = grid
|
|
42
|
+
|
|
43
|
+
return np.arange(min, max + delta, delta, dtype=np.double)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def get_dimless_halfcoords(grid, coord, COORD0):
|
|
47
|
+
"""given a list or array, return dimensionless halfcoords.
|
|
48
|
+
For list call "halfcoords_from_coordlims" before
|
|
49
|
+
de-dimensionalising. For array simply return array / COORD0"""
|
|
50
|
+
|
|
51
|
+
if type(grid) not in [list, np.ndarray]:
|
|
52
|
+
raise ValueError("input " + coord + " grid is neither list or array ")
|
|
53
|
+
|
|
54
|
+
elif isinstance(grid, list):
|
|
55
|
+
grid = linearlyspaced_halfcoords(grid)
|
|
56
|
+
|
|
57
|
+
elif isinstance(grid, np.ndarray):
|
|
58
|
+
grid = np.array(grid, dtype=np.double)
|
|
59
|
+
|
|
60
|
+
return grid / COORD0
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def check_halfcoords(grid, coord):
|
|
64
|
+
"""check that x , y or z grid limits are for at least
|
|
65
|
+
1 cell with strictly monotonically increasing bounds"""
|
|
66
|
+
|
|
67
|
+
if coord not in ["z", "x", "y"]:
|
|
68
|
+
raise ValueError("coord should be x, y or z")
|
|
69
|
+
|
|
70
|
+
criteria = len(grid) >= 2 and np.all(np.diff(grid) > 0)
|
|
71
|
+
if criteria is False:
|
|
72
|
+
errmsg = str(grid) + " does not meet criteria for " + coord + " halfcoords"
|
|
73
|
+
raise ValueError(errmsg)
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def gridboxboundaries_from_halfcoords(allhalfcoords, ngridboxes):
|
|
77
|
+
"""returns gbxbounds dictionary. Each key of gbxbounds is a gridbox's
|
|
78
|
+
index and the corresponding value is the gridbox's
|
|
79
|
+
[zmin, zmax, xmin, xmax, ymin, ymax] boundaries"""
|
|
80
|
+
|
|
81
|
+
zhalfs = allhalfcoords[0]
|
|
82
|
+
xhalfs = allhalfcoords[1]
|
|
83
|
+
yhalfs = allhalfcoords[2]
|
|
84
|
+
|
|
85
|
+
gbxbounds, ii = {}, 0
|
|
86
|
+
for j in range(len(yhalfs) - 1):
|
|
87
|
+
for i in range(len(xhalfs) - 1):
|
|
88
|
+
for k in range(len(zhalfs) - 1):
|
|
89
|
+
zbounds = [zhalfs[k], zhalfs[k + 1]]
|
|
90
|
+
xbounds = [xhalfs[i], xhalfs[i + 1]]
|
|
91
|
+
ybounds = [yhalfs[j], yhalfs[j + 1]]
|
|
92
|
+
gbxbounds[ii] = zbounds + xbounds + ybounds
|
|
93
|
+
ii += 1
|
|
94
|
+
|
|
95
|
+
if len(gbxbounds) != ngridboxes:
|
|
96
|
+
raise ValueError("not enough gbxbounds for ngridboxes")
|
|
97
|
+
else:
|
|
98
|
+
print("created boundaries for", ngridboxes, "gridboxes")
|
|
99
|
+
|
|
100
|
+
return gbxbounds
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
def dimless_gridboxboundaries(zgrid, xgrid, ygrid, COORD0):
|
|
104
|
+
"""use zgrid, xgrid and ygrid lists or arrays to create half coords
|
|
105
|
+
of gridboxes (ie. their boundaries). Return single list of zhalf,
|
|
106
|
+
then xhalf, then yhalf coords and a list of len(3) which states how
|
|
107
|
+
many of each z, x and y coords there are"""
|
|
108
|
+
|
|
109
|
+
allhalfcoords, ndims = [], [] # z, x and y half coords in 1 continuous list
|
|
110
|
+
for grid, coord in zip([zgrid, xgrid, ygrid], ["z", "x", "y"]):
|
|
111
|
+
halfcoords = get_dimless_halfcoords(grid, coord, COORD0)
|
|
112
|
+
check_halfcoords(halfcoords, coord)
|
|
113
|
+
|
|
114
|
+
allhalfcoords.append(halfcoords)
|
|
115
|
+
ndims.append(len(halfcoords) - 1)
|
|
116
|
+
|
|
117
|
+
gbxbounds = gridboxboundaries_from_halfcoords(allhalfcoords, np.prod(ndims))
|
|
118
|
+
|
|
119
|
+
ndims = np.asarray(ndims, dtype=np.uint)
|
|
120
|
+
gbxindicies = np.array(list(gbxbounds.keys()), dtype=np.uintc).flatten()
|
|
121
|
+
gbxboundsdata = np.array(list(gbxbounds.values()), dtype=np.double).flatten()
|
|
122
|
+
|
|
123
|
+
return ndims, gbxindicies, gbxboundsdata
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
def set_arraydtype(arr, dtype):
|
|
127
|
+
og = type(arr[0])
|
|
128
|
+
if og != dtype:
|
|
129
|
+
arr = np.array(arr, dtype=dtype)
|
|
130
|
+
|
|
131
|
+
warning = (
|
|
132
|
+
"WARNING! dtype of attributes is being changed!"
|
|
133
|
+
+ " from "
|
|
134
|
+
+ str(og)
|
|
135
|
+
+ " to "
|
|
136
|
+
+ str(dtype)
|
|
137
|
+
)
|
|
138
|
+
raise ValueError(warning)
|
|
139
|
+
|
|
140
|
+
return list(arr)
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
def ctype_compatible_gridboxboundaries(ndims, idxs, bounds):
|
|
144
|
+
"""check type of gridbox boundaries data is compatible
|
|
145
|
+
with c type double. If not, change type and raise error"""
|
|
146
|
+
|
|
147
|
+
datatypes = [np.uint, np.uintc, np.double]
|
|
148
|
+
|
|
149
|
+
ndims = set_arraydtype(ndims, datatypes[0])
|
|
150
|
+
idxs = set_arraydtype(idxs, datatypes[1])
|
|
151
|
+
bounds = set_arraydtype(bounds, datatypes[2])
|
|
152
|
+
|
|
153
|
+
datalist = ndims + idxs + bounds
|
|
154
|
+
|
|
155
|
+
return datalist, datatypes
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
def write_gridboxboundaries_binary(
|
|
159
|
+
grid_filename, zgrid, xgrid, ygrid, constants_filename
|
|
160
|
+
):
|
|
161
|
+
"""zgrid, xgrid and ygrid can either be list of
|
|
162
|
+
[min coord, max coord, delta] or they can be arrays of
|
|
163
|
+
their half coordinates (ie. gridbox boundaries). If the former,
|
|
164
|
+
first create half coordinates. In both cases, de-dimensionalise
|
|
165
|
+
and write the boundaries to a binary file, "filename" """
|
|
166
|
+
|
|
167
|
+
COORD0 = get_COORD0_from_constsfile(constants_filename)
|
|
168
|
+
|
|
169
|
+
ndims, gbxindicies, gbxboundsdata = dimless_gridboxboundaries(
|
|
170
|
+
zgrid, xgrid, ygrid, COORD0
|
|
171
|
+
)
|
|
172
|
+
zxy = [len(zgrid) - 1, len(xgrid) - 1, len(ygrid) - 1]
|
|
173
|
+
zxy = [str(x) for x in zxy]
|
|
174
|
+
metastr = (
|
|
175
|
+
"Variables in this file are ndims in (z,x,y), then the "
|
|
176
|
+
+ str(np.prod(ndims))
|
|
177
|
+
+ " gridbox indicies followed by the"
|
|
178
|
+
+ " [zmin, zmax, xmin, xmax, ymin, ymax]"
|
|
179
|
+
+ " coordinates for each gridbox's boundaries."
|
|
180
|
+
+ " Grid has dimensions "
|
|
181
|
+
+ zxy[0]
|
|
182
|
+
+ "x"
|
|
183
|
+
+ zxy[1]
|
|
184
|
+
+ "x"
|
|
185
|
+
+ zxy[2]
|
|
186
|
+
)
|
|
187
|
+
|
|
188
|
+
ndata = [len(dt) for dt in [ndims, gbxindicies, gbxboundsdata]]
|
|
189
|
+
data, datatypes = ctype_compatible_gridboxboundaries(
|
|
190
|
+
ndims, gbxindicies, gbxboundsdata
|
|
191
|
+
)
|
|
192
|
+
scale_factors = np.array([1.0, 1.0, COORD0], dtype=np.double)
|
|
193
|
+
units = [b" ", b" ", b"m"]
|
|
194
|
+
|
|
195
|
+
writebinary.writebinary(
|
|
196
|
+
grid_filename, data, ndata, datatypes, units, scale_factors, metastr
|
|
197
|
+
)
|