splitnc 0.0.0__tar.gz

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.
splitnc-0.0.0/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
splitnc-0.0.0/PKG-INFO ADDED
@@ -0,0 +1,144 @@
1
+ Metadata-Version: 2.4
2
+ Name: splitnc
3
+ Version: 0.0.0
4
+ Summary: Split multi-field ESM1.6 files into single-field files
5
+ Author-email: Joshua Torrance <joshua.torrance@anu.edu.au>, Spencer Wong <spencer.wong@anu.edu.au>
6
+ Maintainer-email: Joshua Torrance <joshua.torrance@anu.edu.au>
7
+ License-Expression: Apache-2.0
8
+ Project-URL: Repository, https://github.com/ACCESS-NRI/splitnc
9
+ Keywords: ACCESS-NRI,netcdf
10
+ Requires-Python: >=3.9
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+ Requires-Dist: netcdf4
14
+ Requires-Dist: xarray
15
+ Provides-Extra: test
16
+ Requires-Dist: pytest; extra == "test"
17
+ Requires-Dist: netCDF4; extra == "test"
18
+ Requires-Dist: xarray>2025.1.2; extra == "test"
19
+ Dynamic: license-file
20
+
21
+ # splitnc
22
+ This script splits multi-field netCDF files into single-field files.
23
+ It is designed to work on ESM1.6's atmosphere and ice files.
24
+
25
+ ## Automatic Field Identification
26
+ By default `splitnc` will attempt to identify the fields for a multi-field netCDF files by looking for variables that no other variables depend on.
27
+ A variable that no others depend on is likely to be a field.
28
+ E.g. many variables depend on `time`, but none depend on `sea_surface_temperature`.
29
+
30
+ Alternatively the fields to separate to individual files can be specified as a comma separated list with the `--field-vars` command line option.
31
+ `--field-vars` interprets each item as regex, e.g. one could use `--field-vars fld_.+` to match all variable names that start with the string `fld_`.
32
+
33
+ ## "Ancillary" Variables
34
+
35
+ Some variables with no dependents should not be separated into individual files, these variables must be manually identified with the `--shared-vars` command line option.
36
+ These variables will then be present in every output file.
37
+ Regex is also supported for this option.
38
+
39
+ If there are ancillary fields that should only be present in only some of the output field files then multiple invocations of `splitnc` using `--field-vars` and `--shared-vars` will be required.
40
+
41
+ Example of these variables are the `latitude_longitude` found in atmosphere files or the `uarea`, `tmask`, `tarea`, `VGRDb`, `VGRDi`, `VGRDs` variables from ice files.
42
+
43
+ ## Config File
44
+
45
+ The `-c`/`--command-line-file` option can be used to supply a filepath to a file that contains command line options.
46
+ If this option is used, all other options supplied on the command line will be ignored.
47
+ Newline characters in the file will be treated as whitespace, i.e. newlines can be used as well as spaces to separate command line arguments.
48
+
49
+ For example to replicate this command line,
50
+ ```
51
+ splitnc --verbose --overwrite --output-dir /output/directory --shared-vars latitude_longitude --rename-regex "(?P<newname>.+)_\d+" /input/directory/*.nc
52
+ ```
53
+ the following file could be used;
54
+ ```
55
+ --verbose
56
+ --overwrite
57
+ --output-dir /output/directory
58
+ --shared-vars latitude_longitude
59
+ --rename-regex "(?P<newname>.+)_\d+"
60
+ /input/directory/*.nc
61
+ ```
62
+
63
+ ## Command Line Options
64
+
65
+ ```quote
66
+ usage: splitnc [-h] [--field-vars FIELD_VAR1,FIELD_VAR2,...] [--shared-vars SHARED_VAR1,SHARED_VAR2,...]
67
+ [--output-name-pattern OUTPUT_NAME_PATTERN] [--rename-regex REGEX] [--output-dir OUTPUT_DIR] [--overwrite] [-v]
68
+ [-c COMMAND_LINE_FILE]
69
+ [filepaths ...]
70
+
71
+ Splits a multi-field netCDF file into separate one-field files
72
+
73
+ positional arguments:
74
+ filepaths One or more filepaths to process
75
+
76
+ options:
77
+ -h, --help show this help message and exit
78
+ --field-vars FIELD_VAR1,FIELD_VAR2,...
79
+ Specify the names of the field variables to split into separate files - dimensions, bounds, and
80
+ coordinates of these fields will be included in each file. Disables automatic field variable
81
+ identification. Regex patterns can be used here.
82
+ --shared-vars SHARED_VAR1,SHARED_VAR2,...
83
+ Specify the names of variables that should be shared across files that cannot be automatically
84
+ identified, as a comma separated list. Regex patterns can be used here.
85
+ --excluded-vars EXCLUDED_VAR1,EXCLUDED_VAR2,...
86
+ Specify the names of variables that should be excluded from files. This option can be used with
87
+ automatic identification of field variables. Regex patterns can be used here.
88
+ --rename-regex REGEX Look for duplicated coordinate names that match the given regex and rename them to the first
89
+ "newname" capture group in the regex. E.g. "(?P<newname>.*)_\d+" will match "time_0" and rename
90
+ it to "time".
91
+ --use-esm1p6-filenames
92
+ Use the ESM1.6 filename pattern for the output files:
93
+ access-esm1p6.{component}.{dimensions}.{field}.{freq}.{time_cell_method}.{datestamp}.nc
94
+ splitnc will attempt to deduce all the components of the filename. If this option is not given
95
+ {field}_{original_filename} will be used.
96
+ --fix-cell-methods Correct cell_methods by adding 'time: point' to cell_methods for variables that have 'time' but
97
+ not 'time_bnds' and no other 'time' cell_methods.
98
+ --file-freq FILE_FREQ
99
+ Specify the frequency of the files (not the data), e.g. if each file contains a month of data
100
+ then the file-frequency is '1mon'. Used to determine the resolution of the timestamp for ESM1.6
101
+ filenames. Follows the ACCESS frequency vocabulary (e.g. '1yr', '1mon', '1day', '1hr'), any
102
+ unrecognised frequency will use the full timestamp. Defaults to '1yr'.
103
+ --output-dir OUTPUT_DIR
104
+ Output directory for the processed files. If not given output files will be placed in the same
105
+ directory as the original file.
106
+ --overwrite Overwrite existing files
107
+ --dont-update-history
108
+ Disable automatic update of history attribute
109
+ -v, --verbose
110
+ -c COMMAND_LINE_FILE, --command-line-file COMMAND_LINE_FILE
111
+ A file containing a list of command-line arguments. Newlines in this file will be ignored. If
112
+ supplied all other command line arguments will be ignored.
113
+ ```
114
+
115
+ ## Example Usage
116
+
117
+ `splitnc` just needs the `xarray` and `netCDF4` python modules.
118
+ On Gadi use load any module with `xarray`, such as `conda/analysis3`.
119
+ Alternatively create a new python environment and install `xarray` and `netCDF4`.
120
+
121
+ ### Atmosphere
122
+ To use this script for split multi-field atmosphere files from ACCESS-ESM1.6:
123
+ ```bash
124
+ splitnc --shared-vars latitude_longitude --rename-regex "(?P<newname>.+)_\\d+" $INPUT_DIR/*.nc
125
+ ```
126
+
127
+ `splitnc` will automatically determine which variables are fields by looking at which variables depend on other variables.
128
+ Variables with nothing depending on them are deemed to be fields.
129
+ Alternatively one could use `--field-vars fld_.+` to match the variable names in these files.
130
+
131
+ The `--rename-regex` option with the supplied regex will rename variables like
132
+ `time_0` or `pseudo_level_0` are renamed to `time` or `pseudo_level`.
133
+
134
+ The `--shared-vars` option will ensure that the variable `latitude_longitude` is
135
+ included in all files even though none of the field variable depend on it.
136
+
137
+ ### Ice
138
+ To use this script for split multi-field ice files from ACCESS-ESM1.6:
139
+ ```bash
140
+ splitnc --shared-vars uarea,tmask,tarea --excluded-vars VGRD. $INPUT_DIR/*.nc
141
+ ```
142
+
143
+ In comparison to the atmosphere files, ice files have different shared-vars and there are no duplicated variables that require renaming.
144
+ The variables `VGRDb`, `VGRDi`, and `VGRDs` are not required and can thus be excluded from the output.
@@ -0,0 +1,124 @@
1
+ # splitnc
2
+ This script splits multi-field netCDF files into single-field files.
3
+ It is designed to work on ESM1.6's atmosphere and ice files.
4
+
5
+ ## Automatic Field Identification
6
+ By default `splitnc` will attempt to identify the fields for a multi-field netCDF files by looking for variables that no other variables depend on.
7
+ A variable that no others depend on is likely to be a field.
8
+ E.g. many variables depend on `time`, but none depend on `sea_surface_temperature`.
9
+
10
+ Alternatively the fields to separate to individual files can be specified as a comma separated list with the `--field-vars` command line option.
11
+ `--field-vars` interprets each item as regex, e.g. one could use `--field-vars fld_.+` to match all variable names that start with the string `fld_`.
12
+
13
+ ## "Ancillary" Variables
14
+
15
+ Some variables with no dependents should not be separated into individual files, these variables must be manually identified with the `--shared-vars` command line option.
16
+ These variables will then be present in every output file.
17
+ Regex is also supported for this option.
18
+
19
+ If there are ancillary fields that should only be present in only some of the output field files then multiple invocations of `splitnc` using `--field-vars` and `--shared-vars` will be required.
20
+
21
+ Example of these variables are the `latitude_longitude` found in atmosphere files or the `uarea`, `tmask`, `tarea`, `VGRDb`, `VGRDi`, `VGRDs` variables from ice files.
22
+
23
+ ## Config File
24
+
25
+ The `-c`/`--command-line-file` option can be used to supply a filepath to a file that contains command line options.
26
+ If this option is used, all other options supplied on the command line will be ignored.
27
+ Newline characters in the file will be treated as whitespace, i.e. newlines can be used as well as spaces to separate command line arguments.
28
+
29
+ For example to replicate this command line,
30
+ ```
31
+ splitnc --verbose --overwrite --output-dir /output/directory --shared-vars latitude_longitude --rename-regex "(?P<newname>.+)_\d+" /input/directory/*.nc
32
+ ```
33
+ the following file could be used;
34
+ ```
35
+ --verbose
36
+ --overwrite
37
+ --output-dir /output/directory
38
+ --shared-vars latitude_longitude
39
+ --rename-regex "(?P<newname>.+)_\d+"
40
+ /input/directory/*.nc
41
+ ```
42
+
43
+ ## Command Line Options
44
+
45
+ ```quote
46
+ usage: splitnc [-h] [--field-vars FIELD_VAR1,FIELD_VAR2,...] [--shared-vars SHARED_VAR1,SHARED_VAR2,...]
47
+ [--output-name-pattern OUTPUT_NAME_PATTERN] [--rename-regex REGEX] [--output-dir OUTPUT_DIR] [--overwrite] [-v]
48
+ [-c COMMAND_LINE_FILE]
49
+ [filepaths ...]
50
+
51
+ Splits a multi-field netCDF file into separate one-field files
52
+
53
+ positional arguments:
54
+ filepaths One or more filepaths to process
55
+
56
+ options:
57
+ -h, --help show this help message and exit
58
+ --field-vars FIELD_VAR1,FIELD_VAR2,...
59
+ Specify the names of the field variables to split into separate files - dimensions, bounds, and
60
+ coordinates of these fields will be included in each file. Disables automatic field variable
61
+ identification. Regex patterns can be used here.
62
+ --shared-vars SHARED_VAR1,SHARED_VAR2,...
63
+ Specify the names of variables that should be shared across files that cannot be automatically
64
+ identified, as a comma separated list. Regex patterns can be used here.
65
+ --excluded-vars EXCLUDED_VAR1,EXCLUDED_VAR2,...
66
+ Specify the names of variables that should be excluded from files. This option can be used with
67
+ automatic identification of field variables. Regex patterns can be used here.
68
+ --rename-regex REGEX Look for duplicated coordinate names that match the given regex and rename them to the first
69
+ "newname" capture group in the regex. E.g. "(?P<newname>.*)_\d+" will match "time_0" and rename
70
+ it to "time".
71
+ --use-esm1p6-filenames
72
+ Use the ESM1.6 filename pattern for the output files:
73
+ access-esm1p6.{component}.{dimensions}.{field}.{freq}.{time_cell_method}.{datestamp}.nc
74
+ splitnc will attempt to deduce all the components of the filename. If this option is not given
75
+ {field}_{original_filename} will be used.
76
+ --fix-cell-methods Correct cell_methods by adding 'time: point' to cell_methods for variables that have 'time' but
77
+ not 'time_bnds' and no other 'time' cell_methods.
78
+ --file-freq FILE_FREQ
79
+ Specify the frequency of the files (not the data), e.g. if each file contains a month of data
80
+ then the file-frequency is '1mon'. Used to determine the resolution of the timestamp for ESM1.6
81
+ filenames. Follows the ACCESS frequency vocabulary (e.g. '1yr', '1mon', '1day', '1hr'), any
82
+ unrecognised frequency will use the full timestamp. Defaults to '1yr'.
83
+ --output-dir OUTPUT_DIR
84
+ Output directory for the processed files. If not given output files will be placed in the same
85
+ directory as the original file.
86
+ --overwrite Overwrite existing files
87
+ --dont-update-history
88
+ Disable automatic update of history attribute
89
+ -v, --verbose
90
+ -c COMMAND_LINE_FILE, --command-line-file COMMAND_LINE_FILE
91
+ A file containing a list of command-line arguments. Newlines in this file will be ignored. If
92
+ supplied all other command line arguments will be ignored.
93
+ ```
94
+
95
+ ## Example Usage
96
+
97
+ `splitnc` just needs the `xarray` and `netCDF4` python modules.
98
+ On Gadi use load any module with `xarray`, such as `conda/analysis3`.
99
+ Alternatively create a new python environment and install `xarray` and `netCDF4`.
100
+
101
+ ### Atmosphere
102
+ To use this script for split multi-field atmosphere files from ACCESS-ESM1.6:
103
+ ```bash
104
+ splitnc --shared-vars latitude_longitude --rename-regex "(?P<newname>.+)_\\d+" $INPUT_DIR/*.nc
105
+ ```
106
+
107
+ `splitnc` will automatically determine which variables are fields by looking at which variables depend on other variables.
108
+ Variables with nothing depending on them are deemed to be fields.
109
+ Alternatively one could use `--field-vars fld_.+` to match the variable names in these files.
110
+
111
+ The `--rename-regex` option with the supplied regex will rename variables like
112
+ `time_0` or `pseudo_level_0` are renamed to `time` or `pseudo_level`.
113
+
114
+ The `--shared-vars` option will ensure that the variable `latitude_longitude` is
115
+ included in all files even though none of the field variable depend on it.
116
+
117
+ ### Ice
118
+ To use this script for split multi-field ice files from ACCESS-ESM1.6:
119
+ ```bash
120
+ splitnc --shared-vars uarea,tmask,tarea --excluded-vars VGRD. $INPUT_DIR/*.nc
121
+ ```
122
+
123
+ In comparison to the atmosphere files, ice files have different shared-vars and there are no duplicated variables that require renaming.
124
+ The variables `VGRDb`, `VGRDi`, and `VGRDs` are not required and can thus be excluded from the output.
@@ -0,0 +1,42 @@
1
+ [project]
2
+ name = "splitnc"
3
+ dynamic = ["version"]
4
+ authors = [
5
+ {name = "Joshua Torrance", email="joshua.torrance@anu.edu.au"},
6
+ {name = "Spencer Wong", email="spencer.wong@anu.edu.au"},
7
+ ]
8
+ maintainers = [
9
+ {name = "Joshua Torrance", email="joshua.torrance@anu.edu.au"},
10
+ ]
11
+ description = "Split multi-field ESM1.6 files into single-field files"
12
+ readme = "README.md"
13
+ license = "Apache-2.0"
14
+ keywords = ["ACCESS-NRI", "netcdf"]
15
+ requires-python = ">=3.9"
16
+ dependencies = [
17
+ "netcdf4",
18
+ "xarray",
19
+ ]
20
+
21
+ [project.optional-dependencies]
22
+ test = [
23
+ "pytest",
24
+ "netCDF4",
25
+ "xarray>2025.1.2",
26
+ ]
27
+
28
+ [project.urls]
29
+ Repository = "https://github.com/ACCESS-NRI/splitnc"
30
+
31
+ [project.scripts]
32
+ splitnc = "splitnc:main"
33
+
34
+ [build-system]
35
+ build-backend = "setuptools.build_meta"
36
+ requires = [
37
+ "setuptools",
38
+ ]
39
+
40
+ [tool.pytest.ini_options]
41
+ testpaths = "test"
42
+ pythonpath = "src"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1 @@
1
+ from .splitnc import *