avoca 0.16.0__tar.gz → 0.17.0__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 (74) hide show
  1. {avoca-0.16.0 → avoca-0.17.0}/PKG-INFO +1 -1
  2. {avoca-0.16.0 → avoca-0.17.0}/avoca/bindings/gcwerks.py +5 -3
  3. {avoca-0.16.0 → avoca-0.17.0}/avoca/io.py +5 -0
  4. {avoca-0.16.0 → avoca-0.17.0}/avoca/testing/utils.py +1 -1
  5. {avoca-0.16.0 → avoca-0.17.0}/pyproject.toml +1 -1
  6. avoca-0.17.0/tests/bindings/gcwerks_with_flags.dat +7 -0
  7. avoca-0.17.0/tests/bindings/test_gcwerks.py +32 -0
  8. {avoca-0.16.0 → avoca-0.17.0}/tests/test_io.py +8 -1
  9. avoca-0.16.0/tests/bindings/test_gcwerks.py +0 -11
  10. {avoca-0.16.0 → avoca-0.17.0}/.gitignore +0 -0
  11. {avoca-0.16.0 → avoca-0.17.0}/.gitlab-ci.yml +0 -0
  12. {avoca-0.16.0 → avoca-0.17.0}/.readthedocs.yaml +0 -0
  13. {avoca-0.16.0 → avoca-0.17.0}/.vscode/settings.json +0 -0
  14. {avoca-0.16.0 → avoca-0.17.0}/LICENCE.txt +0 -0
  15. {avoca-0.16.0 → avoca-0.17.0}/README.md +0 -0
  16. {avoca-0.16.0 → avoca-0.17.0}/avoca/__init__.py +0 -0
  17. {avoca-0.16.0 → avoca-0.17.0}/avoca/bindings/__init__.py +0 -0
  18. {avoca-0.16.0 → avoca-0.17.0}/avoca/bindings/ebas.py +0 -0
  19. {avoca-0.16.0 → avoca-0.17.0}/avoca/bindings/ebas_flags.py +0 -0
  20. {avoca-0.16.0 → avoca-0.17.0}/avoca/bindings/gcwerks-report.conf +0 -0
  21. {avoca-0.16.0 → avoca-0.17.0}/avoca/bindings/gcwerks_gui.py +0 -0
  22. {avoca-0.16.0 → avoca-0.17.0}/avoca/bindings/nabel.py +0 -0
  23. {avoca-0.16.0 → avoca-0.17.0}/avoca/bindings/qa_tool.py +0 -0
  24. {avoca-0.16.0 → avoca-0.17.0}/avoca/bindings/synspec.py +0 -0
  25. {avoca-0.16.0 → avoca-0.17.0}/avoca/export_nas.py +0 -0
  26. {avoca-0.16.0 → avoca-0.17.0}/avoca/flagging.py +0 -0
  27. {avoca-0.16.0 → avoca-0.17.0}/avoca/flags.py +0 -0
  28. {avoca-0.16.0 → avoca-0.17.0}/avoca/logging.py +0 -0
  29. {avoca-0.16.0 → avoca-0.17.0}/avoca/manager.py +0 -0
  30. {avoca-0.16.0 → avoca-0.17.0}/avoca/plots.py +0 -0
  31. {avoca-0.16.0 → avoca-0.17.0}/avoca/qa_class/__init__.py +0 -0
  32. {avoca-0.16.0 → avoca-0.17.0}/avoca/qa_class/abstract.py +0 -0
  33. {avoca-0.16.0 → avoca-0.17.0}/avoca/qa_class/concs.py +0 -0
  34. {avoca-0.16.0 → avoca-0.17.0}/avoca/qa_class/generate_classes_doc.py +0 -0
  35. {avoca-0.16.0 → avoca-0.17.0}/avoca/qa_class/invalid.py +0 -0
  36. {avoca-0.16.0 → avoca-0.17.0}/avoca/qa_class/rolling.py +0 -0
  37. {avoca-0.16.0 → avoca-0.17.0}/avoca/qa_class/rt.py +0 -0
  38. {avoca-0.16.0 → avoca-0.17.0}/avoca/qa_class/test.py +0 -0
  39. {avoca-0.16.0 → avoca-0.17.0}/avoca/qa_class/zscore.py +0 -0
  40. {avoca-0.16.0 → avoca-0.17.0}/avoca/requirements.py +0 -0
  41. {avoca-0.16.0 → avoca-0.17.0}/avoca/settings.py +0 -0
  42. {avoca-0.16.0 → avoca-0.17.0}/avoca/testing/__init__.py +0 -0
  43. {avoca-0.16.0 → avoca-0.17.0}/avoca/testing/df.py +0 -0
  44. {avoca-0.16.0 → avoca-0.17.0}/avoca/utils/__init__.py +0 -0
  45. {avoca-0.16.0 → avoca-0.17.0}/avoca/utils/flags_doc.py +0 -0
  46. {avoca-0.16.0 → avoca-0.17.0}/avoca/utils/torch_models.py +0 -0
  47. {avoca-0.16.0 → avoca-0.17.0}/data/.avoca/config.yaml +0 -0
  48. {avoca-0.16.0 → avoca-0.17.0}/data/CH0001G.20240219123300.20240307132229.online_gc.NMHC.air.16d.61mn.CH01L_Agilent_GC-MS-MEDUSA_Medusa-12_JFJ.CH01L_gc_ms.lev0.nas +0 -0
  49. {avoca-0.16.0 → avoca-0.17.0}/data/tests/missing_area_cols.csv +0 -0
  50. {avoca-0.16.0 → avoca-0.17.0}/data/tests/new_NMHC_lev0.nas +0 -0
  51. {avoca-0.16.0 → avoca-0.17.0}/data/voc_jan2jun_2023.csv +0 -0
  52. {avoca-0.16.0 → avoca-0.17.0}/docs/Makefile +0 -0
  53. {avoca-0.16.0 → avoca-0.17.0}/docs/make.bat +0 -0
  54. {avoca-0.16.0 → avoca-0.17.0}/docs/source/bindings/ebas.md +0 -0
  55. {avoca-0.16.0 → avoca-0.17.0}/docs/source/bindings/gcwerks.md +0 -0
  56. {avoca-0.16.0 → avoca-0.17.0}/docs/source/bindings/index.rst +0 -0
  57. {avoca-0.16.0 → avoca-0.17.0}/docs/source/bindings/qa_tool.md +0 -0
  58. {avoca-0.16.0 → avoca-0.17.0}/docs/source/conf.py +0 -0
  59. {avoca-0.16.0 → avoca-0.17.0}/docs/source/index.rst +0 -0
  60. {avoca-0.16.0 → avoca-0.17.0}/docs/source/quickstart.ipynb +0 -0
  61. {avoca-0.16.0 → avoca-0.17.0}/examples/config.yaml +0 -0
  62. {avoca-0.16.0 → avoca-0.17.0}/examples/convert_synspec_to_gcwerks.py +0 -0
  63. {avoca-0.16.0 → avoca-0.17.0}/examples/data_qa.ipynb +0 -0
  64. {avoca-0.16.0 → avoca-0.17.0}/examples/data_qa_gcwerks.ipynb +0 -0
  65. {avoca-0.16.0 → avoca-0.17.0}/examples/export_gc_werks.py +0 -0
  66. {avoca-0.16.0 → avoca-0.17.0}/examples/export_gc_werks_secondary_peaks.py +0 -0
  67. {avoca-0.16.0 → avoca-0.17.0}/examples/get_tanks.ipynb +0 -0
  68. {avoca-0.16.0 → avoca-0.17.0}/examples/read_nas.ipynb +0 -0
  69. {avoca-0.16.0 → avoca-0.17.0}/tests/bindings/gcwerks.dat +0 -0
  70. {avoca-0.16.0 → avoca-0.17.0}/tests/bindings/test_ebas.py +0 -0
  71. {avoca-0.16.0 → avoca-0.17.0}/tests/bindings/test_qatool.py +0 -0
  72. {avoca-0.16.0 → avoca-0.17.0}/tests/test_assigners.py +0 -0
  73. {avoca-0.16.0 → avoca-0.17.0}/tests/test_flagging.py +0 -0
  74. {avoca-0.16.0 → avoca-0.17.0}/tests/test_manager.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: avoca
3
- Version: 0.16.0
3
+ Version: 0.17.0
4
4
  Summary: @voc@: Quality assessement of measurement data
5
5
  Project-URL: Homepage, https://gitlab.com/empa503/atmospheric-measurements/avoca
6
6
  Project-URL: Bug Tracker, https://gitlab.com/empa503/atmospheric-measurements/avoca/-/issues
@@ -90,6 +90,8 @@ flag_values = {
90
90
  "F": QA_Flag.INVALIDATED_EXT,
91
91
  # X: An X flag is an 'un-do' the flag. If there is an automatic flag by GCWerks, but I decide I want that data point still included, I have the option to set an X flag.
92
92
  "X": ValidFlag,
93
+ # Nans read from pandas
94
+ pd.NA: QA_Flag.MISSING,
93
95
  }
94
96
 
95
97
  # Show the flags and the columns they are applied to
@@ -229,9 +231,9 @@ def read_gcwerks(
229
231
  flags: pd.Series = serie_str.str[-1]
230
232
  if col[1] in cols_float:
231
233
  # Remove the flag value when given
232
- serie_str = serie_str.apply(
233
- lambda x: x[:-1] if x[-1] in flags_allowed else x
234
- )
234
+ mask_flag_allowed = flags.isin(flags_allowed)
235
+ serie_str = serie_str.where(~mask_flag_allowed, serie_str.str[:-1])
236
+
235
237
  # Convert the serie to numeric
236
238
  df[col] = pd.to_numeric(serie_str, errors="coerce")
237
239
 
@@ -8,6 +8,11 @@ date_format = "%Y-%m-%d %H:%M:%S"
8
8
 
9
9
  def to_csv(df: pd.DataFrame, path: Path, **kwargs) -> None:
10
10
  """Export a dataframe to a csv file."""
11
+
12
+ # Put the columsn with "-" first
13
+ cols = df.columns.tolist()
14
+ cols_sorted = sorted(cols, key=lambda x: (x[0] != "-", x))
15
+ df = df[cols_sorted]
11
16
  df.to_csv(path, index=False, date_format=date_format, **kwargs)
12
17
 
13
18
 
@@ -3,7 +3,7 @@ import pandas as pd
3
3
 
4
4
  def make_dt_index(df: pd.DataFrame | pd.Index) -> pd.DataFrame | pd.Index:
5
5
  """Create a datetime index for the dataframe."""
6
- index = pd.date_range(start="2023-01-01", periods=len(df), freq="h")
6
+ index = pd.date_range(start="2023-01-01", periods=len(df), freq="h", unit="s")
7
7
  if isinstance(df, pd.Index):
8
8
  return index
9
9
  return df.set_index(index)
@@ -5,7 +5,7 @@ build-backend = "hatchling.build"
5
5
 
6
6
  [project]
7
7
  name = "avoca"
8
- version = "0.16.0"
8
+ version = "0.17.0"
9
9
  authors = [
10
10
  { name="Lionel Constantin", email="lionel.constantin@empa.ch" },
11
11
  ]
@@ -0,0 +1,7 @@
1
+ Created: 6 May 21 07:53 GMT
2
+ - - - - methane ethane ethene propane propene
3
+ date time volume type area area area area area
4
+ 210101 0025 1.0 air 1506527 187333 54226 124023 9004
5
+ 210101 0126 1.1 air nan 191969 72289 124942 14789
6
+ 210101 0226 1.0 air 1445250H 175597 39373 104478 6643
7
+ 210101 0327 0.9 air 1434459* 171817 38493 99796 5926
@@ -0,0 +1,32 @@
1
+ from pathlib import Path
2
+
3
+ import pandas as pd
4
+
5
+ from avoca.bindings.gcwerks import read_gcwerks
6
+ from avoca.flags import QA_Flag
7
+
8
+ this_dir = Path(__file__).parent
9
+
10
+
11
+ def test_read_gcwerks():
12
+ path = this_dir / "gcwerks.dat"
13
+ df = read_gcwerks(path)
14
+ assert len(df) == 4
15
+
16
+
17
+ def test_read_gcwerks_with_flags():
18
+ path = this_dir / "gcwerks_with_flags.dat"
19
+ df = read_gcwerks(path)
20
+ assert len(df) == 4
21
+
22
+ assert df[("methane", "area")].iloc[0] == 1506527
23
+ assert df[("methane", "flag")].iloc[0] == 0
24
+ assert df[("methane", "area")].iloc[2] == 1445250
25
+ assert df[("methane", "flag")].iloc[2] == QA_Flag.HEIGHT_INTEGRATION.value
26
+ assert pd.isna(df[("methane", "area")].iloc[1])
27
+ assert df[("methane", "flag")].iloc[1] == QA_Flag.MISSING.value
28
+ assert pd.isna(df[("methane", "area")].iloc[3])
29
+ assert (
30
+ df[("methane", "flag")].iloc[3]
31
+ == QA_Flag.INVALIDATED_EXT.value + QA_Flag.MISSING.value
32
+ )
@@ -1,3 +1,5 @@
1
+ import pandas as pd
2
+
1
3
  from avoca import io
2
4
  from avoca.testing import testdata_dir
3
5
  from avoca.testing.df import simple_df
@@ -8,8 +10,13 @@ def test_from_to_csv():
8
10
  io.to_csv(simple_df, "simple_df.csv")
9
11
  # Read the dataframe
10
12
  df = io.from_csv("simple_df.csv")
13
+
14
+ # Columns will be sorted differently
15
+ cols_sorted = sorted(simple_df.columns, key=lambda x: (x[0] != "-", x))
16
+ simple_df_sorted = simple_df[cols_sorted]
17
+
11
18
  # Check if the dataframes are equal
12
- assert simple_df.equals(df)
19
+ pd.testing.assert_frame_equal(simple_df_sorted, df)
13
20
 
14
21
 
15
22
  def test_missing_area():
@@ -1,11 +0,0 @@
1
- from pathlib import Path
2
-
3
- from avoca.bindings.gcwerks import read_gcwerks
4
-
5
- this_dir = Path(__file__).parent
6
-
7
-
8
- def test_read_gcwerks():
9
- path = this_dir / "gcwerks.dat"
10
- df = read_gcwerks(path)
11
- assert len(df) == 4
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes