wrfrun 0.2.0__py3-none-any.whl → 0.3.0__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.
Files changed (66) hide show
  1. wrfrun/__init__.py +8 -3
  2. wrfrun/cli.py +69 -29
  3. wrfrun/core/__init__.py +27 -10
  4. wrfrun/core/_config.py +308 -0
  5. wrfrun/core/_constant.py +236 -0
  6. wrfrun/core/_exec_db.py +105 -0
  7. wrfrun/core/_namelist.py +287 -0
  8. wrfrun/core/_record.py +178 -0
  9. wrfrun/core/_resource.py +172 -0
  10. wrfrun/core/base.py +132 -406
  11. wrfrun/core/core.py +196 -0
  12. wrfrun/core/error.py +28 -2
  13. wrfrun/core/replay.py +10 -96
  14. wrfrun/core/server.py +52 -27
  15. wrfrun/core/type.py +171 -0
  16. wrfrun/data.py +304 -139
  17. wrfrun/extension/goos_sst/__init__.py +2 -2
  18. wrfrun/extension/goos_sst/core.py +9 -14
  19. wrfrun/extension/goos_sst/res/__init__.py +0 -1
  20. wrfrun/extension/goos_sst/utils.py +50 -44
  21. wrfrun/extension/littler/core.py +105 -88
  22. wrfrun/extension/utils.py +4 -3
  23. wrfrun/log.py +117 -0
  24. wrfrun/model/__init__.py +11 -7
  25. wrfrun/model/constants.py +52 -0
  26. wrfrun/model/palm/__init__.py +30 -0
  27. wrfrun/model/palm/core.py +145 -0
  28. wrfrun/model/palm/namelist.py +33 -0
  29. wrfrun/model/plot.py +99 -119
  30. wrfrun/model/type.py +116 -0
  31. wrfrun/model/utils.py +9 -20
  32. wrfrun/model/wrf/__init__.py +4 -9
  33. wrfrun/model/wrf/core.py +246 -161
  34. wrfrun/model/wrf/exec_wrap.py +13 -12
  35. wrfrun/model/wrf/geodata.py +116 -100
  36. wrfrun/model/wrf/log.py +103 -0
  37. wrfrun/model/wrf/namelist.py +90 -73
  38. wrfrun/model/wrf/plot.py +102 -0
  39. wrfrun/model/wrf/scheme.py +108 -52
  40. wrfrun/model/wrf/utils.py +39 -25
  41. wrfrun/model/wrf/vtable.py +35 -3
  42. wrfrun/plot/__init__.py +20 -0
  43. wrfrun/plot/wps.py +90 -73
  44. wrfrun/res/__init__.py +103 -5
  45. wrfrun/res/config/config.template.toml +8 -0
  46. wrfrun/res/config/palm.template.toml +23 -0
  47. wrfrun/run.py +105 -77
  48. wrfrun/scheduler/__init__.py +1 -0
  49. wrfrun/scheduler/lsf.py +3 -2
  50. wrfrun/scheduler/pbs.py +3 -2
  51. wrfrun/scheduler/script.py +17 -5
  52. wrfrun/scheduler/slurm.py +3 -2
  53. wrfrun/scheduler/utils.py +14 -2
  54. wrfrun/utils.py +88 -199
  55. wrfrun/workspace/__init__.py +8 -5
  56. wrfrun/workspace/core.py +20 -12
  57. wrfrun/workspace/palm.py +137 -0
  58. wrfrun/workspace/wrf.py +16 -15
  59. wrfrun-0.3.0.dist-info/METADATA +240 -0
  60. wrfrun-0.3.0.dist-info/RECORD +78 -0
  61. wrfrun/core/config.py +0 -923
  62. wrfrun/model/base.py +0 -14
  63. wrfrun-0.2.0.dist-info/METADATA +0 -68
  64. wrfrun-0.2.0.dist-info/RECORD +0 -62
  65. {wrfrun-0.2.0.dist-info → wrfrun-0.3.0.dist-info}/WHEEL +0 -0
  66. {wrfrun-0.2.0.dist-info → wrfrun-0.3.0.dist-info}/entry_points.txt +0 -0
wrfrun/core/type.py ADDED
@@ -0,0 +1,171 @@
1
+ """
2
+ wrfrun.core.type
3
+ #################
4
+
5
+ Define custom types.
6
+
7
+ .. autosummary::
8
+ :toctree: generated/
9
+
10
+ InputFileType
11
+ FileConfigDict
12
+ ExecutableClassConfig
13
+ ExecutableConfig
14
+ """
15
+
16
+ from enum import Enum
17
+ from typing import Optional, TypedDict, Union
18
+
19
+
20
+ class InputFileType(Enum):
21
+ """
22
+ This class is an ``Enum`` class, providing the following values:
23
+
24
+ .. py:attribute:: WRFRUN_RES
25
+ :type: int
26
+ :value: 1
27
+
28
+ Indicating resource files are from the model or ``wrfrun``.
29
+ ``wrfrun`` won't save these files when recording the simulation.
30
+
31
+ .. py:attribute:: CUSTOM_RES
32
+ :type: int
33
+ :value: 2
34
+
35
+ Indicating resource files are provided by the user.
36
+ ``wrfrun`` will also save these files to ``.replay`` file
37
+ when recording the simulation to ensure the simulation is replayable.
38
+ """
39
+
40
+ WRFRUN_RES = 1
41
+ CUSTOM_RES = 2
42
+
43
+
44
+ class FileConfigDict(TypedDict):
45
+ """
46
+ This dict is used to store information about the file, including its path,
47
+ the path it will be copied or moved to, its new name, etc.
48
+ This dict contains following keys:
49
+
50
+ .. py:attribute:: file_path
51
+ :type: str
52
+
53
+ A real file path or a valid URI which can be converted to a file path.
54
+
55
+ .. py:attribute:: save_path
56
+ :type: str
57
+
58
+ Save path of the file.
59
+
60
+ .. py:attribute:: save_name
61
+ :type: str
62
+
63
+ Save name of the file.
64
+
65
+ .. py:attribute:: is_data
66
+ :type: bool
67
+
68
+ If the file is data. If not, ``wrfrun`` will treat it as a config file,
69
+ and always save it to ``.replay`` file when recording the simulation.
70
+
71
+ .. py:attribute:: is_output
72
+ :type: bool
73
+
74
+ If the file is model's output. Output file will never be saved to ``.replay`` file.
75
+ """
76
+
77
+ file_path: str
78
+ save_path: str
79
+ save_name: str
80
+ is_data: bool
81
+ is_output: bool
82
+
83
+
84
+ class ExecutableClassConfig(TypedDict):
85
+ """
86
+ This dict is used to store arguments of ``Executable``'s ``__init__`` function.
87
+
88
+ .. py:attribute:: class_args
89
+ :type: tuple
90
+
91
+ Positional arguments of the class.
92
+
93
+ .. py:attribute:: class_kwargs
94
+ :type: dict
95
+
96
+ Keyword arguments of the class.
97
+ """
98
+
99
+ # only list essential config
100
+ class_args: tuple
101
+ class_kwargs: dict
102
+
103
+
104
+ class ExecutableConfig(TypedDict):
105
+ """
106
+ This dict is used to store all configs of a :class:`ExecutableBase`.
107
+
108
+ .. py:attribute:: name
109
+ :type: str
110
+
111
+ Name of the executable. Each type of executable has a unique name.
112
+
113
+ .. py:attribute:: cmd
114
+ :type: str | list[str]
115
+
116
+ Command of the executable.
117
+
118
+ .. py:attribute:: work_path
119
+ :type: str | None
120
+
121
+ Work path of the executable.
122
+
123
+ .. py:attribute:: mpi_use
124
+ :type: bool
125
+
126
+ If the executable will use MPI.
127
+
128
+ .. py:attribute:: mpi_cmd
129
+ :type: str | None
130
+
131
+ Command name of the MPI.
132
+
133
+ .. py:attribute:: mpi_core_num
134
+ :type: int | None
135
+
136
+ Number of the CPU core to use with MPI.
137
+
138
+ .. py:attribute:: class_config
139
+ :type: ExecutableClassConfig | None
140
+
141
+ A dict stores arguments of ``Executable``'s ``__init__`` function.
142
+
143
+ .. py:attribute:: input_file_config
144
+ :type: list[FileConfigDict] | None
145
+
146
+ A list stores information about input files of the executable.
147
+
148
+ .. py:attribute:: output_file_config
149
+ :type: list[FileConfigDict] | None
150
+
151
+ A list stores information about output files of the executable.
152
+
153
+ .. py:attribute:: custom_config
154
+ :type: dict | None
155
+
156
+ A dict that can be used by subclass to store other configs.
157
+ """
158
+
159
+ name: str
160
+ cmd: Union[str, list[str]]
161
+ work_path: Optional[str]
162
+ mpi_use: bool
163
+ mpi_cmd: Optional[str]
164
+ mpi_core_num: Optional[int]
165
+ class_config: ExecutableClassConfig
166
+ input_file_config: list[FileConfigDict]
167
+ output_file_config: list[FileConfigDict]
168
+ custom_config: dict
169
+
170
+
171
+ __all__ = ["InputFileType", "FileConfigDict", "ExecutableClassConfig", "ExecutableConfig"]