rda-python-miscs 1.0.4__tar.gz → 1.0.6__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.
Files changed (38) hide show
  1. {rda_python_miscs-1.0.4/src/rda_python_miscs.egg-info → rda_python_miscs-1.0.6}/PKG-INFO +1 -1
  2. {rda_python_miscs-1.0.4 → rda_python_miscs-1.0.6}/pyproject.toml +1 -1
  3. {rda_python_miscs-1.0.4 → rda_python_miscs-1.0.6}/src/rda_python_miscs/bashqsub.py +1 -1
  4. {rda_python_miscs-1.0.4 → rda_python_miscs-1.0.6}/src/rda_python_miscs/gdexls.py +20 -20
  5. {rda_python_miscs-1.0.4 → rda_python_miscs-1.0.6}/src/rda_python_miscs/gdexls.usg +12 -12
  6. rda_python_miscs-1.0.6/src/rda_python_miscs/gdexls_standalone.py +12 -0
  7. {rda_python_miscs-1.0.4 → rda_python_miscs-1.0.6}/src/rda_python_miscs/rdacp.py +6 -6
  8. {rda_python_miscs-1.0.4 → rda_python_miscs-1.0.6}/src/rda_python_miscs/tcshqsub.py +1 -1
  9. {rda_python_miscs-1.0.4 → rda_python_miscs-1.0.6/src/rda_python_miscs.egg-info}/PKG-INFO +1 -1
  10. {rda_python_miscs-1.0.4 → rda_python_miscs-1.0.6}/src/rda_python_miscs.egg-info/SOURCES.txt +1 -0
  11. {rda_python_miscs-1.0.4 → rda_python_miscs-1.0.6}/LICENSE +0 -0
  12. {rda_python_miscs-1.0.4 → rda_python_miscs-1.0.6}/MANIFEST.in +0 -0
  13. {rda_python_miscs-1.0.4 → rda_python_miscs-1.0.6}/README.md +0 -0
  14. {rda_python_miscs-1.0.4 → rda_python_miscs-1.0.6}/setup.cfg +0 -0
  15. {rda_python_miscs-1.0.4 → rda_python_miscs-1.0.6}/src/rda_python_miscs/__init__.py +0 -0
  16. {rda_python_miscs-1.0.4 → rda_python_miscs-1.0.6}/src/rda_python_miscs/bashqsub.usg +0 -0
  17. {rda_python_miscs-1.0.4 → rda_python_miscs-1.0.6}/src/rda_python_miscs/pgwget.py +0 -0
  18. {rda_python_miscs-1.0.4 → rda_python_miscs-1.0.6}/src/rda_python_miscs/rdacp.usg +0 -0
  19. {rda_python_miscs-1.0.4 → rda_python_miscs-1.0.6}/src/rda_python_miscs/rdakill.py +0 -0
  20. {rda_python_miscs-1.0.4 → rda_python_miscs-1.0.6}/src/rda_python_miscs/rdakill.usg +0 -0
  21. {rda_python_miscs-1.0.4 → rda_python_miscs-1.0.6}/src/rda_python_miscs/rdals.py +0 -0
  22. {rda_python_miscs-1.0.4 → rda_python_miscs-1.0.6}/src/rda_python_miscs/rdals.usg +0 -0
  23. {rda_python_miscs-1.0.4 → rda_python_miscs-1.0.6}/src/rda_python_miscs/rdamod.py +0 -0
  24. {rda_python_miscs-1.0.4 → rda_python_miscs-1.0.6}/src/rda_python_miscs/rdamod.usg +0 -0
  25. {rda_python_miscs-1.0.4 → rda_python_miscs-1.0.6}/src/rda_python_miscs/rdaown.py +0 -0
  26. {rda_python_miscs-1.0.4 → rda_python_miscs-1.0.6}/src/rda_python_miscs/rdaown.usg +0 -0
  27. {rda_python_miscs-1.0.4 → rda_python_miscs-1.0.6}/src/rda_python_miscs/rdaps.py +0 -0
  28. {rda_python_miscs-1.0.4 → rda_python_miscs-1.0.6}/src/rda_python_miscs/rdaps.usg +0 -0
  29. {rda_python_miscs-1.0.4 → rda_python_miscs-1.0.6}/src/rda_python_miscs/rdasub.py +0 -0
  30. {rda_python_miscs-1.0.4 → rda_python_miscs-1.0.6}/src/rda_python_miscs/rdasub.usg +0 -0
  31. {rda_python_miscs-1.0.4 → rda_python_miscs-1.0.6}/src/rda_python_miscs/rdazip.py +0 -0
  32. {rda_python_miscs-1.0.4 → rda_python_miscs-1.0.6}/src/rda_python_miscs/rdazip.usg +0 -0
  33. {rda_python_miscs-1.0.4 → rda_python_miscs-1.0.6}/src/rda_python_miscs/tcshqsub.usg +0 -0
  34. {rda_python_miscs-1.0.4 → rda_python_miscs-1.0.6}/src/rda_python_miscs.egg-info/dependency_links.txt +0 -0
  35. {rda_python_miscs-1.0.4 → rda_python_miscs-1.0.6}/src/rda_python_miscs.egg-info/entry_points.txt +0 -0
  36. {rda_python_miscs-1.0.4 → rda_python_miscs-1.0.6}/src/rda_python_miscs.egg-info/requires.txt +0 -0
  37. {rda_python_miscs-1.0.4 → rda_python_miscs-1.0.6}/src/rda_python_miscs.egg-info/top_level.txt +0 -0
  38. {rda_python_miscs-1.0.4 → rda_python_miscs-1.0.6}/tests/test_miscs.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rda_python_miscs
3
- Version: 1.0.4
3
+ Version: 1.0.6
4
4
  Summary: RDA Python package to hold RDA miscellaneous utility programs
5
5
  Author-email: Zaihua Ji <zji@ucar.edu>
6
6
  Project-URL: Homepage, https://github.com/NCAR/rda-python-miscs
@@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"
6
6
 
7
7
  [project]
8
8
  name = "rda_python_miscs"
9
- version = "1.0.4"
9
+ version = "1.0.6"
10
10
  authors = [
11
11
  { name="Zaihua Ji", email="zji@ucar.edu" },
12
12
  ]
@@ -24,7 +24,7 @@ DEFMODS = {
24
24
  }
25
25
 
26
26
  DEFLIBS = {
27
- 'default' : "conda activate /glade/work/rdadata/conda-envs/pg-casper",
27
+ 'default' : "conda activate /glade/work/gdexdata/conda-envs/pg-casper",
28
28
  }
29
29
 
30
30
  SWAPMODS = {
@@ -9,7 +9,7 @@
9
9
  # https://github.com/NCAR/rda-utility-programs.git
10
10
  # 2025-09-21 copied from rdals to gdexls
11
11
  # Purpose: list files/directories in a local directory and show additional
12
- # information recorded in RDADB if any
12
+ # information recorded in GDEXDB if any
13
13
  #
14
14
  # Github: https://github.com/NCAR/rda-python-miscs.git
15
15
  #
@@ -31,7 +31,7 @@ CLMT = 500 # reformat list if count reach this limit
31
31
  WIDTHS = [0, 0, 0] # WIDTHS for formated display
32
32
  ALIGNS = [0, 1, 1] # alignment, 0 - left; 1 - right
33
33
 
34
- RDALS = {
34
+ GDEXLS = {
35
35
  'd' : 0, # 1 to list directory information only
36
36
  'f' : 0, # 1 to list file information only
37
37
  'N' : 0, # 1 to list files unformatted
@@ -70,9 +70,9 @@ def main():
70
70
  ms = re.match(r'-(\w)$', arg)
71
71
  if ms:
72
72
  option = ms.group(1)
73
- if option not in RDALS: PgLOG.pglog(arg + ": Unknown Option", PgLOG.LGEREX)
73
+ if option not in GDEXLS: PgLOG.pglog(arg + ": Unknown Option", PgLOG.LGEREX)
74
74
  if 'dfNr'.find(option) > -1:
75
- RDALS[option] = 1
75
+ GDEXLS[option] = 1
76
76
  option = defopt
77
77
  continue
78
78
  if not option: PgLOG.pglog(arg + ": Value provided without option", PgLOG.LGEREX)
@@ -81,9 +81,9 @@ def main():
81
81
  defopt = None
82
82
  else:
83
83
  if option == 'R':
84
- RDALS[option] = int(arg)
84
+ GDEXLS[option] = int(arg)
85
85
  else:
86
- RDALS[option] = arg
86
+ GDEXLS[option] = arg
87
87
  option = defopt
88
88
 
89
89
  if not LINFO['files']:
@@ -92,10 +92,10 @@ def main():
92
92
  sys.stderr.write(LINFO['curdir'] + ": Empty directory\n")
93
93
  PgLOG.pgexit(1)
94
94
 
95
- if not (RDALS['d'] or RDALS['f']):
96
- RDALS['d'] = RDALS['f'] = 1 # list both directories and files as default
97
- if not RDALS['D']: RDALS['D'] = '|' if RDALS['N'] else " " # default delimiter for no format display
98
- if not RDALS['R'] and RDALS['r']: RDALS['R'] = 1000
95
+ if not (GDEXLS['d'] or GDEXLS['f']):
96
+ GDEXLS['d'] = GDEXLS['f'] = 1 # list both directories and files as default
97
+ if not GDEXLS['D']: GDEXLS['D'] = '|' if GDEXLS['N'] else " " # default delimiter for no format display
98
+ if not GDEXLS['R'] and GDEXLS['r']: GDEXLS['R'] = 1000
99
99
 
100
100
  display_top_list(LINFO['files']) # display or cache file/directory list
101
101
  if LINFO['pcnt'] > 0: display_format_list() # if some left over
@@ -115,7 +115,7 @@ def main():
115
115
  msg += "{} File{}".format(LINFO['fcnt'], s)
116
116
  print("Total {} displayed".format(msg))
117
117
  elif (LINFO['dcnt'] + LINFO['gcnt'] + LINFO['fcnt']) == 0:
118
- sys.stderr.write((LINFO['tpath'] if LINFO['tpath'] else LINFO['curdir']) + ": No RDA data information found\n")
118
+ sys.stderr.write((LINFO['tpath'] if LINFO['tpath'] else LINFO['curdir']) + ": No GDEX data information found\n")
119
119
  PgLOG.pgexit(1)
120
120
 
121
121
  PgLOG.pgexit(0)
@@ -140,7 +140,7 @@ def display_top_list(files):
140
140
  if not re.match(r'^/', file): file = PgLOG.join_paths(LINFO['curdir'], file)
141
141
  LINFO['tpath'] = (op.dirname(file) if display else file) + "/"
142
142
  if display: display_line(file, isdir)
143
- if isdir and (RDALS['R'] or not display or not LINFO['dsid']):
143
+ if isdir and (GDEXLS['R'] or not display or not LINFO['dsid']):
144
144
  fs = sorted(glob.glob(file + "/*"))
145
145
  display_list(fs, 1)
146
146
  if LINFO['pcnt'] > CLMT: display_format_list()
@@ -153,7 +153,7 @@ def display_list(files, level):
153
153
  for file in files:
154
154
  isdir = 1 if op.isdir(file) else 0
155
155
  display_line(file, isdir)
156
- if isdir and level < RDALS['R']:
156
+ if isdir and level < GDEXLS['R']:
157
157
  fs = sorted(glob.glob(file + "/*"))
158
158
  display_list(fs, level+1)
159
159
  if LINFO['pcnt'] > CLMT: display_format_list()
@@ -179,7 +179,7 @@ def display_line(file, isdir):
179
179
  LINFO['dhome'] = "{}/{}".format(PgLOG.PGLOG['DSDHOME'], LINFO['dsid'])
180
180
  if LINFO['dhome'] == file:
181
181
  file = re.sub(r'^{}'.format(LINFO['tpath']), '', file, 1)
182
- if RDALS['d']:
182
+ if GDEXLS['d']:
183
183
  title = pgrec['title'] if pgrec['title'] else ''
184
184
  display_record(["D" + file, pgrec['ns'], str(pgrec['nc']), title])
185
185
  LINFO['dcnt'] += 1
@@ -192,7 +192,7 @@ def display_line(file, isdir):
192
192
  return
193
193
 
194
194
  if isdir:
195
- if RDALS['d']: # check and display group info for directory
195
+ if GDEXLS['d']: # check and display group info for directory
196
196
  pgrec = PgDBI.pgget("dsgroup", "title, (dwebcnt + nwebcnt) nc, (dweb_size + nweb_size) ns",
197
197
  "dsid = '{}' AND webpath = '{}'".format(LINFO['dsid'], wfile), PgLOG.LGEREX)
198
198
  if pgrec:
@@ -201,7 +201,7 @@ def display_line(file, isdir):
201
201
  display_record(["G" + file, pgrec['ns'], str(pgrec['nc']), title])
202
202
  LINFO['gcnt'] += 1
203
203
 
204
- elif RDALS['f']: # check and display file info
204
+ elif GDEXLS['f']: # check and display file info
205
205
  pgrec = PgSplit.pgget_wfile(LINFO['dsid'], "data_size, data_format, note",
206
206
  "wfile = '{}'".format(wfile), PgLOG.LGEREX)
207
207
  if pgrec:
@@ -219,8 +219,8 @@ def display_line(file, isdir):
219
219
  def display_record(disp):
220
220
 
221
221
  disp[1] = get_float_string(disp[1])
222
- if RDALS['N']:
223
- print(RDALS['D'].join(disp))
222
+ if GDEXLS['N']:
223
+ print(GDEXLS['D'].join(disp))
224
224
  else:
225
225
  LINFO['pgrecs'].append(disp)
226
226
  LINFO['pcnt'] += 1
@@ -240,7 +240,7 @@ def display_format_list():
240
240
  disp[i] = "{:>{}}".format(disp[i], WIDTHS[i])
241
241
  else:
242
242
  disp[i] = "{:{}}".format(disp[i], WIDTHS[i])
243
- print(RDALS['D'].join(disp))
243
+ print(GDEXLS['D'].join(disp))
244
244
 
245
245
  LINFO['pcnt'] = 0
246
246
 
@@ -271,7 +271,7 @@ def get_real_path(path):
271
271
  elif re.match(r'^/gpfs/csfs1/', path):
272
272
  path = re.sub(r'^/gpfs/csfs1', '/glade/campaign', path, 1)
273
273
 
274
- return path
274
+ return op.realpath(path)
275
275
 
276
276
  #
277
277
  # call main() to start program
@@ -18,10 +18,10 @@
18
18
 
19
19
  - Option -d, list directory information only. Directory information
20
20
  is included as default. Add this option to exclude file information;
21
-
21
+
22
22
  - Option -f, list file information only. File information
23
23
  is included as default. Add this option to exclude directory information;
24
-
24
+
25
25
  - Option -N, list files unformatted;
26
26
 
27
27
  - Option -h, display this help document;
@@ -42,19 +42,19 @@
42
42
 
43
43
  This utility program can be executed anywhere. Nothing is displayed if neither
44
44
  directory nor file information pre-gathered in database.
45
-
46
- For examples, to check directories and files of ds277.6, you can
47
-
48
- 1. Change into the dataset home data directory as 'cd /PathTo/ds277.6' and
45
+
46
+ For examples, to check directories and files of d277006, you can
47
+
48
+ 1. Change into the dataset home data directory as 'cd /PathTo/d277006' and
49
49
  execute 'gdexls'; add recursive option '-r' to check directories and files
50
50
  further into the sub-directories, or change directory into a sub-directory
51
51
  to check files inside of it.
52
-
53
- 2. Pass an absolute path to gdexls as 'gdexls /PathTo/ds277.6/' or as
54
- 'gdexls /PathTo/ds277.6/*'; without the ending by '/' or an appended
52
+
53
+ 2. Pass an absolute path to gdexls as 'gdexls /PathTo/d277006/' or as
54
+ 'gdexls /PathTo/d277006/*'; without the ending by '/' or an appended
55
55
  wildcard symbol '*' information of the dataset itself is check unless
56
56
  the recursive option '-r' or '-R RecursiveLevel' is present
57
-
57
+
58
58
  3. If the current directory is in another dataset home data directory,
59
- such as /PathTo/ds277.7, you can pass a relative path to gdexls
60
- as 'gdexls ../ds277.6/' or as 'gdexls ../ds277.6/*'
59
+ such as /PathTo/d277006, you can pass a relative path to gdexls
60
+ as 'gdexls ../d277006/' or as 'gdexls ../d277006/*'
@@ -0,0 +1,12 @@
1
+ #!/glade/work/zji/conda-envs/pg-rda/bin/python
2
+ # -*- coding: utf-8 -*-
3
+ # 2025-09-23, zji@ucar.edu, created for a standalone version of gdexls
4
+ import re
5
+ import sys
6
+ pgpath = '/glade/work/zji/conda-envs/pg-rda/lib/python3.10/site-packages'
7
+ if pgpath not in sys.path: sys.path.insert(0, pgpath)
8
+
9
+ from rda_python_miscs.gdexls import main
10
+ if __name__ == '__main__':
11
+ sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
12
+ sys.exit(main())
@@ -101,7 +101,7 @@ def main():
101
101
  if ms:
102
102
  CINFO['tpath'] = ms.group(1)
103
103
  else:
104
- tinfo = PgFile.check_rda_file(RDACP['t'], RDACP['th'], 0, PgLOG.LGWNEX)
104
+ tinfo = PgFile.check_gdex_file(RDACP['t'], RDACP['th'], 0, PgLOG.LGWNEX)
105
105
  if tinfo and tinfo['isfile'] == 0: CINFO['tpath'] = RDACP['t']
106
106
  PgLOG.PGLOG['FILEMODE'] = RDACP['F']
107
107
  PgLOG.PGLOG['EXECMODE'] = RDACP['D']
@@ -141,9 +141,9 @@ def copy_top_list(files):
141
141
 
142
142
  for file in files:
143
143
  if RDACP['th'] and not PgUtil.pgcmp(RDACP['th'], PgLOG.PGLOG['BACKUPNM'], 1):
144
- info = PgFile.check_globus_file(file, 'rda-glade', 0, PgLOG.LGWNEX)
144
+ info = PgFile.check_globus_file(file, 'gdex-glade', 0, PgLOG.LGWNEX)
145
145
  else:
146
- info = PgFile.check_rda_file(file, RDACP['fh'], 0, PgLOG.LGWNEX)
146
+ info = PgFile.check_gdex_file(file, RDACP['fh'], 0, PgLOG.LGWNEX)
147
147
  if not info:
148
148
  PgLOG.pglog("{}{}: {}".format(CINFO['fhost'], file, PgLOG.PGLOG['MISSFILE']), PgLOG.LOGERR)
149
149
  continue
@@ -165,7 +165,7 @@ def copy_top_list(files):
165
165
  if info['isfile']:
166
166
  CINFO['tcnt'] += copy_file(file, info['isfile'])
167
167
  elif dosub or RDACP['R']:
168
- flist = PgFile.rda_glob(file, RDACP['fh'], 0, PgLOG.LGWNEX)
168
+ flist = PgFile.gdex_glob(file, RDACP['fh'], 0, PgLOG.LGWNEX)
169
169
  if flist: copy_list(flist, 1, file)
170
170
  else:
171
171
  PgLOG.pglog("{}{}: Add option -r to copy directory".format(CINFO['fhost'], file), PgLOG.LGEREX)
@@ -182,7 +182,7 @@ def copy_list(tlist, level, cdir):
182
182
  fcnt += copy_file(file, tlist[file]['isfile'])
183
183
  CINFO['cpflag'] |= (1 if tlist[file]['isfile'] else 2)
184
184
  elif level < RDACP['R']:
185
- flist = PgFile.rda_glob(file, RDACP['fh'], 0, PgLOG.LGWNEX)
185
+ flist = PgFile.gdex_glob(file, RDACP['fh'], 0, PgLOG.LGWNEX)
186
186
  if flist: copy_list(flist, level+1, file)
187
187
 
188
188
  if fcnt > 1: # display sub count if two or more files are copied
@@ -203,7 +203,7 @@ def copy_file(fromfile, isfile):
203
203
  else:
204
204
  tofile = RDACP['t']
205
205
 
206
- return (1 if PgFile.copy_rda_file(tofile, fromfile, RDACP['th'], RDACP['fh'], PgLOG.LGWNEX) else 0)
206
+ return (1 if PgFile.copy_gdex_file(tofile, fromfile, RDACP['th'], RDACP['fh'], PgLOG.LGWNEX) else 0)
207
207
 
208
208
  #
209
209
  # call main() to start program
@@ -24,7 +24,7 @@ DEFMODS = {
24
24
  }
25
25
 
26
26
  DEFLIBS = {
27
- 'default' : "conda activate /glade/work/rdadata/conda-envs/pg-casper",
27
+ 'default' : "conda activate /glade/work/gdexdata/conda-envs/pg-casper",
28
28
  }
29
29
 
30
30
  SWAPMODS = {
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rda_python_miscs
3
- Version: 1.0.4
3
+ Version: 1.0.6
4
4
  Summary: RDA Python package to hold RDA miscellaneous utility programs
5
5
  Author-email: Zaihua Ji <zji@ucar.edu>
6
6
  Project-URL: Homepage, https://github.com/NCAR/rda-python-miscs
@@ -7,6 +7,7 @@ src/rda_python_miscs/bashqsub.py
7
7
  src/rda_python_miscs/bashqsub.usg
8
8
  src/rda_python_miscs/gdexls.py
9
9
  src/rda_python_miscs/gdexls.usg
10
+ src/rda_python_miscs/gdexls_standalone.py
10
11
  src/rda_python_miscs/pgwget.py
11
12
  src/rda_python_miscs/rdacp.py
12
13
  src/rda_python_miscs/rdacp.usg