rda-python-icoads 1.0.11__tar.gz → 1.0.13__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.

Potentially problematic release.


This version of rda-python-icoads might be problematic. Click here for more details.

Files changed (37) hide show
  1. {rda_python_icoads-1.0.11/src/rda_python_icoads.egg-info → rda_python_icoads-1.0.13}/PKG-INFO +1 -1
  2. {rda_python_icoads-1.0.11 → rda_python_icoads-1.0.13}/pyproject.toml +1 -1
  3. {rda_python_icoads-1.0.11 → rda_python_icoads-1.0.13}/src/rda_python_icoads/PgIMMA.py +4 -2
  4. {rda_python_icoads-1.0.11 → rda_python_icoads-1.0.13}/src/rda_python_icoads/cleanicoads.py +6 -6
  5. {rda_python_icoads-1.0.11 → rda_python_icoads-1.0.13}/src/rda_python_icoads/fillicoads.py +22 -5
  6. {rda_python_icoads-1.0.11 → rda_python_icoads-1.0.13}/src/rda_python_icoads/imma1_subset.py +4 -2
  7. {rda_python_icoads-1.0.11 → rda_python_icoads-1.0.13/src/rda_python_icoads.egg-info}/PKG-INFO +1 -1
  8. {rda_python_icoads-1.0.11 → rda_python_icoads-1.0.13}/LICENSE +0 -0
  9. {rda_python_icoads-1.0.11 → rda_python_icoads-1.0.13}/MANIFEST.in +0 -0
  10. {rda_python_icoads-1.0.11 → rda_python_icoads-1.0.13}/README.md +0 -0
  11. {rda_python_icoads-1.0.11 → rda_python_icoads-1.0.13}/setup.cfg +0 -0
  12. {rda_python_icoads-1.0.11 → rda_python_icoads-1.0.13}/src/rda_python_icoads/R3.0-stat_doc.pdf +0 -0
  13. {rda_python_icoads-1.0.11 → rda_python_icoads-1.0.13}/src/rda_python_icoads/README_R3.0_Subset.html +0 -0
  14. {rda_python_icoads-1.0.11 → rda_python_icoads-1.0.13}/src/rda_python_icoads/__init__.py +0 -0
  15. {rda_python_icoads-1.0.11 → rda_python_icoads-1.0.13}/src/rda_python_icoads/checkicoads.py +0 -0
  16. {rda_python_icoads-1.0.11 → rda_python_icoads-1.0.13}/src/rda_python_icoads/countattm.py +0 -0
  17. {rda_python_icoads-1.0.11 → rda_python_icoads-1.0.13}/src/rda_python_icoads/countattmvar.py +0 -0
  18. {rda_python_icoads-1.0.11 → rda_python_icoads-1.0.13}/src/rda_python_icoads/counticoads.py +0 -0
  19. {rda_python_icoads-1.0.11 → rda_python_icoads-1.0.13}/src/rda_python_icoads/countsst.py +0 -0
  20. {rda_python_icoads-1.0.11 → rda_python_icoads-1.0.13}/src/rda_python_icoads/fillinventory.py +0 -0
  21. {rda_python_icoads-1.0.11 → rda_python_icoads-1.0.13}/src/rda_python_icoads/fillitable.py +0 -0
  22. {rda_python_icoads-1.0.11 → rda_python_icoads-1.0.13}/src/rda_python_icoads/fillmonth.py +0 -0
  23. {rda_python_icoads-1.0.11 → rda_python_icoads-1.0.13}/src/rda_python_icoads/fixiidx.py +0 -0
  24. {rda_python_icoads-1.0.11 → rda_python_icoads-1.0.13}/src/rda_python_icoads/maxsst.py +0 -0
  25. {rda_python_icoads-1.0.11 → rda_python_icoads-1.0.13}/src/rda_python_icoads/msg +0 -0
  26. {rda_python_icoads-1.0.11 → rda_python_icoads-1.0.13}/src/rda_python_icoads/msg3.0_subset_readme.txt +0 -0
  27. {rda_python_icoads-1.0.11 → rda_python_icoads-1.0.13}/src/rda_python_icoads/msg3_subset.py +0 -0
  28. {rda_python_icoads-1.0.11 → rda_python_icoads-1.0.13}/src/rda_python_icoads/msg_download.py +0 -0
  29. {rda_python_icoads-1.0.11 → rda_python_icoads-1.0.13}/src/rda_python_icoads/msgsubset.f +0 -0
  30. {rda_python_icoads-1.0.11 → rda_python_icoads-1.0.13}/src/rda_python_icoads/rdimma1_csv.f +0 -0
  31. {rda_python_icoads-1.0.11 → rda_python_icoads-1.0.13}/src/rda_python_icoads/writeicoads.py +0 -0
  32. {rda_python_icoads-1.0.11 → rda_python_icoads-1.0.13}/src/rda_python_icoads.egg-info/SOURCES.txt +0 -0
  33. {rda_python_icoads-1.0.11 → rda_python_icoads-1.0.13}/src/rda_python_icoads.egg-info/dependency_links.txt +0 -0
  34. {rda_python_icoads-1.0.11 → rda_python_icoads-1.0.13}/src/rda_python_icoads.egg-info/entry_points.txt +0 -0
  35. {rda_python_icoads-1.0.11 → rda_python_icoads-1.0.13}/src/rda_python_icoads.egg-info/requires.txt +0 -0
  36. {rda_python_icoads-1.0.11 → rda_python_icoads-1.0.13}/src/rda_python_icoads.egg-info/top_level.txt +0 -0
  37. {rda_python_icoads-1.0.11 → rda_python_icoads-1.0.13}/tests/test_icoads.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rda_python_icoads
3
- Version: 1.0.11
3
+ Version: 1.0.13
4
4
  Summary: RDA python package to manage RDA ICOADS datasets
5
5
  Author-email: Zaihua Ji <zji@ucar.edu>
6
6
  Project-URL: Homepage, https://github.com/NCAR/rda-python-icoads
@@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"
6
6
 
7
7
  [project]
8
8
  name = "rda_python_icoads"
9
- version = "1.0.11"
9
+ version = "1.0.13"
10
10
  authors = [
11
11
  { name="Zaihua Ji", email="zji@ucar.edu" },
12
12
  ]
@@ -1122,8 +1122,10 @@ def get_itidx_date(uid):
1122
1122
  pgrec = PgDBI.pgget(table, "*", cond, PgLOG.LGEREX)
1123
1123
  if not pgrec:
1124
1124
  msg = "{}-{}: suid-rn3 not in {}".format(suid, CURRN3, table)
1125
- if CURRN3 < 0: msg += "\nProvide a RN3 (>= 0) to proceed"
1126
- PgLOG.pglog(msg, PgLOG.LGEREX)
1125
+ if CURRN3 < 0:
1126
+ PgLOG.pglog(msg + "\nProvide a RN3 (>= 0) to proceed", PgLOG.LGEREX)
1127
+ else:
1128
+ return PgLOG.pglog(msg + ", SKIP it", PgLOG.WARNLG)
1127
1129
 
1128
1130
  if CHKEXIST: # check
1129
1131
  table = f"{IVADSC}.{ATTMNAME}_{pgrec['tidx']}"
@@ -68,7 +68,7 @@ def main():
68
68
  PgLOG.pgexit()
69
69
 
70
70
  PgLOG.PGLOG['LOGFILE'] = "icoads.log"
71
- PgDBI.ivaddb_dbname()
71
+ PgDBI.set_scname(dbname = 'ivaddb', scname = PgIMMA.IVADSC, lnname = 'ivaddb', dbhost = PgLOG.PGLOG['PMISCHOST'])
72
72
  PgLOG.cmdlog("cleanicoads {}".format(' '.join(argv)))
73
73
  set_table_info()
74
74
  clean_imma_data()
@@ -80,7 +80,7 @@ def main():
80
80
  #
81
81
  def set_table_info():
82
82
 
83
- table = "cntldb.inventory"
83
+ table = f"{PgIMMA.CNTLSC}.inventory"
84
84
  if PVALS['edate']:
85
85
  PVALS['dcnd'] = "date BETWEEN '{}' AND '{}'".format(PVALS['bdate'], PVALS['edate'])
86
86
  else:
@@ -97,7 +97,7 @@ def set_table_info():
97
97
  #
98
98
  def clean_imma_data():
99
99
 
100
- table = "cntldb.inventory"
100
+ table = f"{PgIMMA.CNTLSC}.inventory"
101
101
 
102
102
  for i in range(PVALS['tcnt']):
103
103
  tidx = PVALS['tinfo']['tidx'][i]
@@ -127,7 +127,7 @@ def clean_imma_data_for_tidx(tidx, cnd):
127
127
  #
128
128
  def clean_one_attm_for_tidx(aname, tidx, cnd):
129
129
 
130
- table = "{}_{}".format(aname, tidx)
130
+ table = f"{PgIMMA.IVADSC}.{aname}_{tidx}"
131
131
  if not PgDBI.pgcheck(table): return 0 # not record to delete
132
132
 
133
133
  if aname == 'iuida': clean_itidx_for_tidx(table, cnd)
@@ -144,7 +144,7 @@ def clean_one_attm_for_tidx(aname, tidx, cnd):
144
144
  #
145
145
  def clean_itidx_for_tidx(table, cnd):
146
146
 
147
- tname = "cntldb.itidx"
147
+ tname = f"{PgIMMA.CNTLSC}.itidx"
148
148
  uids = PgDBI.pgmget(table, "distinct (substring(uid, 1, 2)) uida", cnd, PgLOG.LGEREX)
149
149
  ucnt = len(uids['uida']) if uids else 0
150
150
  for i in range(ucnt):
@@ -159,7 +159,7 @@ def clean_itidx_for_tidx(table, cnd):
159
159
  #
160
160
  def clean_iattm_for_tidx(aname, tidx, cnt):
161
161
 
162
- table = "cntldb.iattm"
162
+ table = f"{PgIMMA.CNTLSC}.iattm"
163
163
  cnd = "attm = '{}' AND tidx = {}".format(aname, tidx)
164
164
  pgrec = {'count' : cnt}
165
165
  PgDBI.pgupdt(table, pgrec, cnd, PgLOG.LGWNEX)
@@ -46,29 +46,36 @@ def main():
46
46
  leaduid = 1
47
47
  elif arg == "-e":
48
48
  chkexist = 1
49
+ elif arg == "-f":
50
+ option = 'f'
49
51
  elif arg == "-r":
50
52
  option = 'r'
51
53
  elif arg == "-i":
52
54
  addinventory = 1
53
55
  elif re.match(r'^-', arg):
54
56
  PgLOG.pglog(arg + ": Invalid Option", PgLOG.LGWNEX)
57
+ elif option == 'f':
58
+ get_imma_filelist(arg)
59
+ option = None
55
60
  elif option == 'r':
56
61
  rn3 = int(arg)
62
+ option = None
57
63
  else:
58
64
  PVALS['files'].append(arg)
59
65
 
60
66
  if not PVALS['files']:
61
- print("Usage: fillicoads [-a] [-e] [-i] [-r] [-u] FileNameList")
67
+ print("Usage: fillicoads [-a] [-e] [-f InputFile] [-i] [-r RN3] [-u] FileList")
62
68
  print(" At least one file name needs to fill icoads data into Postgres Server")
63
69
  print(" Option -a: add all attms, including multi-line ones, such as IVAD and REANQC")
70
+ print(" Option -f: provide a filename holding a list of IMMA1 files")
64
71
  print(" Option -i: add daily counting records into inventory table")
65
- print(" Option -r: last digit of IMMA release number")
72
+ print(" Option -r: the Third digit of IMMA release number")
66
73
  print(" Option -u: standalone attachment records with leading 6-character UID")
67
74
  print(" Option -e: check existing record before adding attm")
68
75
  sys.exit(0)
69
76
 
70
77
  PgLOG.PGLOG['LOGFILE'] = "icoads.log"
71
- PgDBI.set_scname(dbname = 'ivaddb', scname = 'ivaddb1', lnname = 'ivaddb', dbhost = PgLOG.PGLOG['PMISCHOST'])
78
+ PgDBI.set_scname(dbname = 'ivaddb', scname = PgIMMA.IVADSC, lnname = 'ivaddb', dbhost = PgLOG.PGLOG['PMISCHOST'])
72
79
 
73
80
  PgLOG.cmdlog("fillicoads {}".format(' '.join(argv)))
74
81
  PgIMMA.init_current_indices(leaduid, chkexist, rn3)
@@ -77,6 +84,15 @@ def main():
77
84
  PgLOG.cmdlog()
78
85
  PgLOG.pgexit()
79
86
 
87
+ #
88
+ # read in imma file list from a given file name
89
+ #
90
+ def get_imma_filelist(fname):
91
+
92
+ with open(fname, "r") as f:
93
+ for line in f.readlines():
94
+ PVALS['files'].append(line.strip())
95
+
80
96
  #
81
97
  # fill up imma data
82
98
  #
@@ -132,8 +148,9 @@ def process_imma_file(fname, addinventory):
132
148
 
133
149
  IMMA.close()
134
150
 
135
- acnts = PgIMMA.add_imma_records(cdate, records)
136
- for i in range(PgIMMA.TABLECOUNT): acounts[i] += acnts[i]
151
+ if cdate and records:
152
+ acnts = PgIMMA.add_imma_records(cdate, records)
153
+ for i in range(PgIMMA.TABLECOUNT): acounts[i] += acnts[i]
137
154
 
138
155
  PgLOG.pglog("{} ({}) filled from {}".format(' '.join(map(str, acounts)), PVALS['names'], op.basename(fname)), PgLOG.LOGWRN)
139
156
 
@@ -607,10 +607,12 @@ def join_attm_fields(aname, record):
607
607
  def subset_table_index(fname, tidx, bdate, edate):
608
608
 
609
609
  atables = {}
610
- PgDBI.ivaddb_scname()
610
+ PgDBI.set_scname(dbname = 'ivaddb', scname = PgIMMA.IVADSC, lnname = 'ivaddb', dbhost = PgLOG.PGLOG['PMISCHOST'])
611
611
 
612
+ tname = f"{PgIMMA.CTNLSC}.iattm"
612
613
  for aname in PVALS['anames']:
613
- atables[aname] = PgDBI.pgget('cntldb.iattm', "", "tidx = {} AND attm = '{}'".format(tidx, aname), PgLOG.LGEREX)
614
+ cnd = f"tidx = {tidx} AND attm = '{aname}'"
615
+ atables[aname] = PgDBI.pgget(tname, "", cnd, PgLOG.LGEREX)
614
616
 
615
617
  dstep = int(PgUtil.diffdate(edate, bdate)/PSTEP)
616
618
  if dstep == 0: dstep = 1
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rda_python_icoads
3
- Version: 1.0.11
3
+ Version: 1.0.13
4
4
  Summary: RDA python package to manage RDA ICOADS datasets
5
5
  Author-email: Zaihua Ji <zji@ucar.edu>
6
6
  Project-URL: Homepage, https://github.com/NCAR/rda-python-icoads