File tree Expand file tree Collapse file tree 2 files changed +8
-5
lines changed
Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change 1- #!/bin/python
1+ #!/bin/python
22
33# Split NetCDF files by variable
44#
88# Output format: date.component.var(.tileX).nc
99
1010import os
11+ from os import path
1112import glob
1213import subprocess
13- import cdo
14+ # import cdo
1415import sys
1516from pathlib import Path
1617
@@ -28,7 +29,7 @@ print(" date: "+date)
2829print(" component: "+component)
2930print(" use subdirs: "+use_subdirs)
3031print("Utilities:")
31- type (cdo )
32+ # type(cdo)
3233
3334#Verify input directory exists and is a directory
3435if inputDir == "":
@@ -43,7 +44,8 @@ if outputDir == "":
4344#Find files to split
4445#extend globbing used to find both tiled and non-tiled files
4546curr_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
4951if use_subdirs:
Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ cd $inputDir
4646shopt -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
109109else
110110 files=$( echo * .$component ? (.tile? ).nc)
111+ echo * .? (.tile? ).nc
111112
112113 # Exit if no input files are found
113114 if [[ $files =~ \* ]]; then
You can’t perform that action at this time.
0 commit comments