givernylocal 2.3.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.
- givernylocal/__init__.py +0 -0
- givernylocal/turbulence_dataset.py +101 -0
- givernylocal/turbulence_gizmos/__init__.py +0 -0
- givernylocal/turbulence_gizmos/basic_gizmos.py +1221 -0
- givernylocal/turbulence_gizmos/constants.py +53 -0
- givernylocal/turbulence_gizmos/variable_dy_grid_ys.py +2316 -0
- givernylocal/turbulence_toolkit.py +212 -0
- givernylocal/version.py +1 -0
- givernylocal-2.3.4.dist-info/LICENSE.txt +201 -0
- givernylocal-2.3.4.dist-info/METADATA +57 -0
- givernylocal-2.3.4.dist-info/RECORD +12 -0
- givernylocal-2.3.4.dist-info/WHEEL +4 -0
givernylocal/__init__.py
ADDED
|
File without changes
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
########################################################################
|
|
2
|
+
#
|
|
3
|
+
# Copyright 2024 Johns Hopkins University
|
|
4
|
+
#
|
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
# you may not use this file except in compliance with the License.
|
|
7
|
+
# You may obtain a copy of the License at
|
|
8
|
+
#
|
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
#
|
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
# See the License for the specific language governing permissions and
|
|
15
|
+
# limitations under the License.
|
|
16
|
+
#
|
|
17
|
+
# Contact: turbulence@pha.jhu.edu
|
|
18
|
+
# Website: http://turbulence.pha.jhu.edu/
|
|
19
|
+
#
|
|
20
|
+
########################################################################
|
|
21
|
+
|
|
22
|
+
import pathlib
|
|
23
|
+
import numpy as np
|
|
24
|
+
from givernylocal.turbulence_gizmos.basic_gizmos import *
|
|
25
|
+
|
|
26
|
+
class turb_dataset():
|
|
27
|
+
def __init__(self, dataset_title = '', output_path = '', auth_token = ''):
|
|
28
|
+
"""
|
|
29
|
+
initialize the class.
|
|
30
|
+
"""
|
|
31
|
+
# check that dataset_title is a valid dataset title.
|
|
32
|
+
check_dataset_title(dataset_title)
|
|
33
|
+
|
|
34
|
+
# turbulence dataset name, e.g. "isotropic8192" or "isotropic1024fine".
|
|
35
|
+
self.dataset_title = dataset_title
|
|
36
|
+
|
|
37
|
+
# cube size.
|
|
38
|
+
self.N = get_dataset_resolution(self.dataset_title)
|
|
39
|
+
# cube spacing (dx, dy, dz).
|
|
40
|
+
self.spacing = get_dataset_spacing(self.dataset_title)
|
|
41
|
+
self.dx, self.dy, self.dz = self.spacing
|
|
42
|
+
|
|
43
|
+
# set the directory for saving any output files.
|
|
44
|
+
self.output_path = output_path.strip()
|
|
45
|
+
if self.output_path == '':
|
|
46
|
+
raise Exception("output_path cannot be an empty string ('')")
|
|
47
|
+
else:
|
|
48
|
+
self.output_path = pathlib.Path(self.output_path)
|
|
49
|
+
|
|
50
|
+
# create the output directory if it does not already exist.
|
|
51
|
+
create_output_folder(self.output_path)
|
|
52
|
+
|
|
53
|
+
# user authorization token for pyJHTDB.
|
|
54
|
+
self.auth_token = auth_token
|
|
55
|
+
|
|
56
|
+
"""
|
|
57
|
+
initialization functions.
|
|
58
|
+
"""
|
|
59
|
+
def init_constants(self, query_type, var, var_original, var_offsets, timepoint, timepoint_original, sint, sint_specified, tint, option,
|
|
60
|
+
num_values_per_datapoint, c):
|
|
61
|
+
"""
|
|
62
|
+
initialize the constants.
|
|
63
|
+
"""
|
|
64
|
+
self.var = var
|
|
65
|
+
self.var_name = var_original
|
|
66
|
+
self.var_offsets = var_offsets
|
|
67
|
+
self.timepoint = timepoint
|
|
68
|
+
self.timepoint_original = timepoint_original
|
|
69
|
+
self.timepoint_end, self.delta_t = option
|
|
70
|
+
# sint and sint_specified are the same except for points near the upper and lower z-axis boundaries in
|
|
71
|
+
# the 'sabl2048*' datasets. for these datasets sint is automatically reduced to an interpolation method
|
|
72
|
+
# that fits within the z-axis boundary since the z-axis is not periodic. sint_specified will be used for
|
|
73
|
+
# reading the proper interpolation lookup table(s) from the metadata files.
|
|
74
|
+
self.sint = sint
|
|
75
|
+
self.sint_specified = sint_specified
|
|
76
|
+
self.tint = tint
|
|
77
|
+
self.num_values_per_datapoint = num_values_per_datapoint
|
|
78
|
+
self.bytes_per_datapoint = c['bytes_per_datapoint']
|
|
79
|
+
self.missing_value_placeholder = c['missing_value_placeholder']
|
|
80
|
+
self.database_file_disk_index = c['database_file_disk_index']
|
|
81
|
+
self.decimals = c['decimals']
|
|
82
|
+
self.chunk_size = c['chunk_size']
|
|
83
|
+
self.file_size = c['file_size']
|
|
84
|
+
self.query_type = query_type
|
|
85
|
+
|
|
86
|
+
# set the byte order for reading the data from the files.
|
|
87
|
+
self.dt = np.dtype(np.float32)
|
|
88
|
+
self.dt = self.dt.newbyteorder('<')
|
|
89
|
+
|
|
90
|
+
# get the number of digits in the timepoint part of the filenames, in order to add leading zeros.
|
|
91
|
+
self.timepoint_digits = get_timepoint_digits(self.dataset_title)
|
|
92
|
+
|
|
93
|
+
# retrieve the dimension offsets.
|
|
94
|
+
self.dimension_offsets = get_dataset_dimension_offsets(self.dataset_title, self.var_offsets)
|
|
95
|
+
|
|
96
|
+
# retrieve the coor offsets.
|
|
97
|
+
self.coor_offsets = get_dataset_coor_offsets(self.dataset_title, self.var_offsets)
|
|
98
|
+
|
|
99
|
+
# set the dataset name to be used in the cutout hdf5 file.
|
|
100
|
+
self.dataset_name = get_output_variable_name(self.var_name) + '_' + str(self.timepoint_original).zfill(4)
|
|
101
|
+
|
|
File without changes
|