Skip to content

Commit 49ef967

Browse files
making feature branch, initial testing
1 parent bae3e7e commit 49ef967

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

app/split-netcdf-python/bin/split-netcdf

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/python
1+
#!/bin/python
22

33
# Split NetCDF files by variable
44
#
@@ -8,9 +8,10 @@
88
# Output format: date.component.var(.tileX).nc
99

1010
import os
11+
from os import path
1112
import glob
1213
import subprocess
13-
import cdo
14+
#import cdo
1415
import sys
1516
from pathlib import Path
1617

@@ -28,7 +29,7 @@ print(" date: "+date)
2829
print(" component: "+component)
2930
print(" use subdirs: "+use_subdirs)
3031
print("Utilities:")
31-
type(cdo)
32+
#type(cdo)
3233

3334
#Verify input directory exists and is a directory
3435
if inputDir == "":
@@ -43,7 +44,8 @@ if outputDir == "":
4344
#Find files to split
4445
#extend globbing used to find both tiled and non-tiled files
4546
curr_dir = os.getcwd()
46-
os.chdir("curr_dir/inputDir")
47+
workdir = os.path.abspath(inputDir)
48+
os.chdir(workdir)
4749

4850
#If in sub-dir mode, process the sub-directories instead of the main one
4951
if use_subdirs:

app/split-netcdf/bin/split-netcdf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ cd $inputDir
4646
shopt -s extglob
4747

4848
# If in sub-dir mode, process the sub-directories instead of the main one
49-
if [[ $use_subdirs ]]; then
49+
if [[ $use_subdirs == 0 ]]; then
5050
for subdir in $(ls); do
5151
pushd $subdir
5252
files=$(echo *.$component?(.tile?).nc)
@@ -108,6 +108,7 @@ if [[ $use_subdirs ]]; then
108108
done
109109
else
110110
files=$(echo *.$component?(.tile?).nc)
111+
echo *.?(.tile?).nc
111112

112113
# Exit if no input files are found
113114
if [[ $files =~ \* ]]; then

0 commit comments

Comments
 (0)