-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed test data, fixed filename regexp
- Loading branch information
1 parent
2428c2d
commit a13de8b
Showing
26 changed files
with
51 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
Generated using the following Python on NCI ARE: | ||
|
||
``` | ||
import netCDF4 | ||
import glob | ||
import os | ||
|
||
srcdir = "/g/data/ik11/outputs/mom6-om4-025/OM4_025.JRA_RYF/" | ||
destdir = "/home/120/mcw120/scratch/" | ||
|
||
targets = ["output000", "output001"] | ||
target_glob = "190*.nc" | ||
|
||
for target in targets: | ||
srcglob = os.path.join(srcdir, target, target_glob) | ||
srcfns = [os.path.basename(_) for _ in glob.glob(srcglob)] | ||
for srcfn in srcfns: | ||
with netCDF4.Dataset(os.path.join(srcdir, target, srcfn), "r") as old, netCDF4.Dataset(os.path.join(destdir, target, srcfn), "w") as new: | ||
print(old.filepath()) | ||
print(new.filepath()) | ||
new.setncattr("file_format", old.file_format) | ||
new.setncatts(old.__dict__) | ||
# new.set_fill_off() | ||
for name, dimension in old.dimensions.items(): | ||
if name == "nv": | ||
dimn = 2 | ||
elif not dimension.isunlimited(): | ||
dimn = 1 | ||
else: | ||
dimn = dimension.size | ||
new.createDimension(name, dimn) | ||
for name, variable in old.variables.items(): | ||
x = new.createVariable(name, variable.datatype, variable.dimensions) | ||
new[name].setncatts(old[name].__dict__) | ||
if name == "time" or name == "nv": # Need time-related data only | ||
new[name][:] = old[name][:] | ||
print(">> Complete!") | ||
print("--") | ||
``` |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified
BIN
+1.69 KB
(100%)
tests/data/access-om4/output000/19000101.ocean_annual_rho2.nc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified
BIN
+2.17 KB
(110%)
tests/data/access-om4/output000/19000101.ocean_month_rho2.nc
Binary file not shown.
Binary file not shown.
Binary file modified
BIN
+3.11 KB
(110%)
tests/data/access-om4/output000/19000101.ocean_scalar_annual.nc
Binary file not shown.
Binary file modified
BIN
+3.2 KB
(110%)
tests/data/access-om4/output000/19000101.ocean_scalar_month.nc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified
BIN
+1.69 KB
(100%)
tests/data/access-om4/output001/19010101.ocean_annual_rho2.nc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified
BIN
+2.17 KB
(110%)
tests/data/access-om4/output001/19010101.ocean_month_rho2.nc
Binary file not shown.
Binary file not shown.
Binary file modified
BIN
+3.11 KB
(110%)
tests/data/access-om4/output001/19010101.ocean_scalar_annual.nc
Binary file not shown.
Binary file modified
BIN
+3.2 KB
(110%)
tests/data/access-om4/output001/19010101.ocean_scalar_month.nc
Binary file not shown.
Binary file not shown.