GLODAP 0.2__tar.gz → 0.3__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: glodap
3
- Version: 0.2
3
+ Version: 0.3
4
4
  Summary: GLODAP downloader and importer in Python
5
5
  Classifier: Development Status :: 4 - Beta
6
6
  Classifier: Programming Language :: Python :: 3.10
@@ -24,7 +24,7 @@ Dynamic: license-file
24
24
  # glodap
25
25
 
26
26
  [![Tests](https://github.com/mvdh7/glodap/actions/workflows/tests.yml/badge.svg?branch=main)](https://github.com/mvdh7/glodap/actions)
27
- [![pypi badge](https://img.shields.io/pypi/v/GLODAP.svg?style=popout)](https://pypi.org/project/GLODAP/)
27
+ [![pypi badge](https://img.shields.io/pypi/v/glodap.svg?style=popout)](https://pypi.org/project/glodap/)
28
28
  [![Conda Version](https://img.shields.io/conda/vn/conda-forge/glodap.svg)](https://anaconda.org/conda-forge/glodap)
29
29
  [![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
30
30
  [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
@@ -48,8 +48,8 @@ df_atlantic = glodap.atlantic()
48
48
  Files are saved by default at `"~/.glodap"`, but this can be controlled with the
49
49
  kwarg `gpath`. See the function docstrings for more information.
50
50
 
51
- The columns of the imported DataFrames are renamed so that they can be passed
52
- directly into [PyCO2SYS v2](https://github.com/mvdh7/PyCO2SYS):
51
+ The columns of the imported DataFrames can be passed
52
+ directly into [PyCO2SYS v2](https://mvdh.xyz/PyCO2SYS):
53
53
 
54
54
  ```python
55
55
  import PyCO2SYS as pyco2
@@ -57,25 +57,20 @@ co2s_atlantic = pyco2.sys(data=df_atlantic, nitrite=None)
57
57
  ```
58
58
 
59
59
  Note `nitrite=None` - this means PyCO2SYS will ignore the `"nitrite"` column,
60
- which is necessary because PyCO2SYS includes the nitrite-nitrous acid
61
- equilibrium but its equilibrium constant is valid only under lab conditions.
60
+ which is necessary because while PyCO2SYS includes the nitrite-nitrous acid
61
+ equilibrium, its equilibrium constant is valid only under lab conditions.
62
+
63
+ Because of how the columns are named, when passing the DataFrame directly to
64
+ PyCO2SYS as above, the system will be solved from DIC and alkalinity, not pH.
62
65
 
63
66
  The columns are the same as in the original GLODAP .mat files available from [glodap.info](https://glodap.info), except:
64
67
  * The `"G2"` at the start of each parameter has been removed.
65
68
  * Flags end with `"_f"` instead of just `"f"`.
66
69
  * There is a `"datetime"` column, which combines the `"year"`, `"month"` and `"day"` but NOT the `"hour"` and `"minute"` (because some of these are missing).
67
- * For compatibility with PyCO2SYS:
68
- - `"tco2"` => `"dic"`
69
- - `"talk"` => `"alkalinity"`
70
- - `"phts25p0"` => `"ph_lab"`
71
- - `"phtsinsitutp"` => `"ph_insitu"`
72
-
73
- Therefore when passing the DataFrame directly to PyCO2SYS as in the example
74
- above, the system will be solved from DIC and alkalinity, not pH.
75
70
 
76
71
  The functions `download` and `read` can also be used for finer control, such as
77
72
  specifying a particular GLODAP version rather than using the latest one. See
78
73
  their function docstrings for more information.
79
74
 
80
- The SHA256 checksum of each downloaded file is checked before the file is
81
- written to disk.
75
+ The .mat files from the GEOMAR mirrors are downloaded, and the SHA256 checksum
76
+ of each downloaded file is checked before the file is written to disk.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: glodap
3
- Version: 0.2
3
+ Version: 0.3
4
4
  Summary: GLODAP downloader and importer in Python
5
5
  Classifier: Development Status :: 4 - Beta
6
6
  Classifier: Programming Language :: Python :: 3.10
@@ -24,7 +24,7 @@ Dynamic: license-file
24
24
  # glodap
25
25
 
26
26
  [![Tests](https://github.com/mvdh7/glodap/actions/workflows/tests.yml/badge.svg?branch=main)](https://github.com/mvdh7/glodap/actions)
27
- [![pypi badge](https://img.shields.io/pypi/v/GLODAP.svg?style=popout)](https://pypi.org/project/GLODAP/)
27
+ [![pypi badge](https://img.shields.io/pypi/v/glodap.svg?style=popout)](https://pypi.org/project/glodap/)
28
28
  [![Conda Version](https://img.shields.io/conda/vn/conda-forge/glodap.svg)](https://anaconda.org/conda-forge/glodap)
29
29
  [![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
30
30
  [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
@@ -48,8 +48,8 @@ df_atlantic = glodap.atlantic()
48
48
  Files are saved by default at `"~/.glodap"`, but this can be controlled with the
49
49
  kwarg `gpath`. See the function docstrings for more information.
50
50
 
51
- The columns of the imported DataFrames are renamed so that they can be passed
52
- directly into [PyCO2SYS v2](https://github.com/mvdh7/PyCO2SYS):
51
+ The columns of the imported DataFrames can be passed
52
+ directly into [PyCO2SYS v2](https://mvdh.xyz/PyCO2SYS):
53
53
 
54
54
  ```python
55
55
  import PyCO2SYS as pyco2
@@ -57,25 +57,20 @@ co2s_atlantic = pyco2.sys(data=df_atlantic, nitrite=None)
57
57
  ```
58
58
 
59
59
  Note `nitrite=None` - this means PyCO2SYS will ignore the `"nitrite"` column,
60
- which is necessary because PyCO2SYS includes the nitrite-nitrous acid
61
- equilibrium but its equilibrium constant is valid only under lab conditions.
60
+ which is necessary because while PyCO2SYS includes the nitrite-nitrous acid
61
+ equilibrium, its equilibrium constant is valid only under lab conditions.
62
+
63
+ Because of how the columns are named, when passing the DataFrame directly to
64
+ PyCO2SYS as above, the system will be solved from DIC and alkalinity, not pH.
62
65
 
63
66
  The columns are the same as in the original GLODAP .mat files available from [glodap.info](https://glodap.info), except:
64
67
  * The `"G2"` at the start of each parameter has been removed.
65
68
  * Flags end with `"_f"` instead of just `"f"`.
66
69
  * There is a `"datetime"` column, which combines the `"year"`, `"month"` and `"day"` but NOT the `"hour"` and `"minute"` (because some of these are missing).
67
- * For compatibility with PyCO2SYS:
68
- - `"tco2"` => `"dic"`
69
- - `"talk"` => `"alkalinity"`
70
- - `"phts25p0"` => `"ph_lab"`
71
- - `"phtsinsitutp"` => `"ph_insitu"`
72
-
73
- Therefore when passing the DataFrame directly to PyCO2SYS as in the example
74
- above, the system will be solved from DIC and alkalinity, not pH.
75
70
 
76
71
  The functions `download` and `read` can also be used for finer control, such as
77
72
  specifying a particular GLODAP version rather than using the latest one. See
78
73
  their function docstrings for more information.
79
74
 
80
- The SHA256 checksum of each downloaded file is checked before the file is
81
- written to disk.
75
+ The .mat files from the GEOMAR mirrors are downloaded, and the SHA256 checksum
76
+ of each downloaded file is checked before the file is written to disk.
@@ -1,7 +1,7 @@
1
1
  # glodap
2
2
 
3
3
  [![Tests](https://github.com/mvdh7/glodap/actions/workflows/tests.yml/badge.svg?branch=main)](https://github.com/mvdh7/glodap/actions)
4
- [![pypi badge](https://img.shields.io/pypi/v/GLODAP.svg?style=popout)](https://pypi.org/project/GLODAP/)
4
+ [![pypi badge](https://img.shields.io/pypi/v/glodap.svg?style=popout)](https://pypi.org/project/glodap/)
5
5
  [![Conda Version](https://img.shields.io/conda/vn/conda-forge/glodap.svg)](https://anaconda.org/conda-forge/glodap)
6
6
  [![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
7
7
  [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
@@ -25,8 +25,8 @@ df_atlantic = glodap.atlantic()
25
25
  Files are saved by default at `"~/.glodap"`, but this can be controlled with the
26
26
  kwarg `gpath`. See the function docstrings for more information.
27
27
 
28
- The columns of the imported DataFrames are renamed so that they can be passed
29
- directly into [PyCO2SYS v2](https://github.com/mvdh7/PyCO2SYS):
28
+ The columns of the imported DataFrames can be passed
29
+ directly into [PyCO2SYS v2](https://mvdh.xyz/PyCO2SYS):
30
30
 
31
31
  ```python
32
32
  import PyCO2SYS as pyco2
@@ -34,25 +34,20 @@ co2s_atlantic = pyco2.sys(data=df_atlantic, nitrite=None)
34
34
  ```
35
35
 
36
36
  Note `nitrite=None` - this means PyCO2SYS will ignore the `"nitrite"` column,
37
- which is necessary because PyCO2SYS includes the nitrite-nitrous acid
38
- equilibrium but its equilibrium constant is valid only under lab conditions.
37
+ which is necessary because while PyCO2SYS includes the nitrite-nitrous acid
38
+ equilibrium, its equilibrium constant is valid only under lab conditions.
39
+
40
+ Because of how the columns are named, when passing the DataFrame directly to
41
+ PyCO2SYS as above, the system will be solved from DIC and alkalinity, not pH.
39
42
 
40
43
  The columns are the same as in the original GLODAP .mat files available from [glodap.info](https://glodap.info), except:
41
44
  * The `"G2"` at the start of each parameter has been removed.
42
45
  * Flags end with `"_f"` instead of just `"f"`.
43
46
  * There is a `"datetime"` column, which combines the `"year"`, `"month"` and `"day"` but NOT the `"hour"` and `"minute"` (because some of these are missing).
44
- * For compatibility with PyCO2SYS:
45
- - `"tco2"` => `"dic"`
46
- - `"talk"` => `"alkalinity"`
47
- - `"phts25p0"` => `"ph_lab"`
48
- - `"phtsinsitutp"` => `"ph_insitu"`
49
-
50
- Therefore when passing the DataFrame directly to PyCO2SYS as in the example
51
- above, the system will be solved from DIC and alkalinity, not pH.
52
47
 
53
48
  The functions `download` and `read` can also be used for finer control, such as
54
49
  specifying a particular GLODAP version rather than using the latest one. See
55
50
  their function docstrings for more information.
56
51
 
57
- The SHA256 checksum of each downloaded file is checked before the file is
58
- written to disk.
52
+ The .mat files from the GEOMAR mirrors are downloaded, and the SHA256 checksum
53
+ of each downloaded file is checked before the file is written to disk.
@@ -14,35 +14,30 @@ downloading the file if it's not already saved locally. For example:
14
14
  Files are saved by default at "~/.glodap", but this can be controlled with the
15
15
  kwarg `gpath`. See the function docstrings for more information.
16
16
 
17
- The columns of the imported DataFrames are renamed so that they can be passed
18
- directly into PyCO2SYS v2:
17
+ The columns of the imported DataFrames can be passed directly into PyCO2SYS v2:
19
18
 
20
19
  >>> import PyCO2SYS as pyco2
21
20
  >>> co2s_atlantic = pyco2.sys(data=df_atlantic, nitrite=None)
22
21
 
23
22
  Note `nitrite=None` - this means PyCO2SYS will ignore the "nitrite" column,
24
- which is necessary because PyCO2SYS includes the nitrite-nitrous acid
25
- equilibrium but its equilibrium constant is valid only under lab conditions.
23
+ which is necessary because while PyCO2SYS includes the nitrite-nitrous acid
24
+ equilibrium, its equilibrium constant is valid only under lab conditions.
25
+
26
+ Because of how the columns are named, when passing the DataFrame directly to
27
+ PyCO2SYS as above, the system will be solved from DIC and alkalinity, not pH.
26
28
 
27
29
  The columns are the same as in the original GLODAP .mat files, except:
28
30
  * The "G2" at the start of each parameter has been removed.
29
31
  * Flags end with "_f" instead of just "f".
30
32
  * There is a "datetime" column, which combines the "year", "month" and "day"
31
33
  but NOT the "hour" and "minute" (because some of these are missing).
32
- * For compatibility with PyCO2SYS:
33
- "tco2" => "dic"
34
- "talk" => "alkalinity"
35
- "phts25p0" => "ph_lab"
36
- "phtsinsitutp" => "ph_insitu"
37
- Therefore when passing the DataFrame directly to PyCO2SYS as in the example
38
- above, the system will be solved from DIC and alkalinity, not pH.
39
34
 
40
35
  The functions `download` and `read` can also be used for finer control, such as
41
36
  specifying a particular GLODAP version rather than using the latest one. See
42
37
  their function docstrings for more information.
43
38
 
44
- The SHA256 checksum of each downloaded file is checked before the file is
45
- written to disk.
39
+ The .mat files from the GEOMAR mirrors are downloaded, and the SHA256 checksum
40
+ of each downloaded file is checked before the file is written to disk.
46
41
  """
47
42
 
48
43
  import hashlib
@@ -57,7 +52,7 @@ from scipy.io import loadmat
57
52
 
58
53
  # Package metadata
59
54
  __author__ = "Humphreys, Matthew P."
60
- __version__ = "0.2"
55
+ __version__ = "0.3"
61
56
 
62
57
  # GLODAP metadata
63
58
  version_latest = "v2.2023"
@@ -171,7 +166,7 @@ def download(region="world", version=None, gpath=None, chunk_size=8192):
171
166
  warn("File checksum not as expected - download failed.")
172
167
 
173
168
 
174
- def read(region="world", version=None, gpath=None, rename_pyco2=True):
169
+ def read(region="world", version=None, gpath=None):
175
170
  """Import a GLODAP data file as a pandas DataFrame, downloading it first
176
171
  if it's not already available locally.
177
172
 
@@ -192,8 +187,6 @@ def read(region="world", version=None, gpath=None, rename_pyco2=True):
192
187
  gpath : str of None, optional
193
188
  Where to the downloaded file is or should be saved, by default `None`,
194
189
  in which case the file is imported from or saved at "~/.glodap".
195
- rename_pyco2 : bool, optional
196
- Whether to rename the columns to work with PyCO2SYS, by default `True`.
197
190
 
198
191
  Returns
199
192
  -------
@@ -261,20 +254,8 @@ def read(region="world", version=None, gpath=None, rename_pyco2=True):
261
254
  for k in keys_integers + keys_flags:
262
255
  df[k] = df[k].astype(int)
263
256
  # Rename columns for PyCO2SYS, if requested
264
- if rename_pyco2:
265
- renamer_pyco2 = {
266
- "tco2": "dic",
267
- "talk": "alkalinity",
268
- "phts25p0": "ph_lab",
269
- "phtsinsitutp": "ph_insitu",
270
- }
271
- renamer_flags = {
272
- k: renamer_pyco2[k[:-1]] + "_f"
273
- if k[:-1] in renamer_pyco2
274
- else k[:-1] + "_f"
275
- for k in keys_flags
276
- }
277
- df = df.rename(columns=renamer_pyco2).rename(columns=renamer_flags)
257
+ renamer_flags = {k: k[:-1] + "_f" for k in keys_flags}
258
+ df = df.rename(columns=renamer_flags)
278
259
  # Calculate datetime for convenience - don't include hour and minute
279
260
  # because some are missing
280
261
  df["datetime"] = pd.to_datetime(
@@ -291,7 +272,7 @@ def read(region="world", version=None, gpath=None, rename_pyco2=True):
291
272
  return df
292
273
 
293
274
 
294
- def arctic(version=None, gpath=None, rename_pyco2=True):
275
+ def arctic(version=None, gpath=None):
295
276
  """Import the latest version of the GLODAP Arctic Ocean dataset,
296
277
  downloading it first if it's not already available locally.
297
278
 
@@ -304,8 +285,6 @@ def arctic(version=None, gpath=None, rename_pyco2=True):
304
285
  gpath : str of None, optional
305
286
  Where to the downloaded file is or should be saved, by default `None`,
306
287
  in which case the file is imported from or saved at "~/.glodap".
307
- rename_pyco2 : bool, optional
308
- Whether to rename the columns to work with PyCO2SYS, by default `True`.
309
288
 
310
289
  Returns
311
290
  -------
@@ -316,11 +295,10 @@ def arctic(version=None, gpath=None, rename_pyco2=True):
316
295
  region="arctic",
317
296
  version=version,
318
297
  gpath=gpath,
319
- rename_pyco2=rename_pyco2,
320
298
  )
321
299
 
322
300
 
323
- def atlantic(version=None, gpath=None, rename_pyco2=True):
301
+ def atlantic(version=None, gpath=None):
324
302
  """Import the latest version of the GLODAP Atlantic Ocean dataset,
325
303
  downloading it first if it's not already available locally.
326
304
 
@@ -333,8 +311,6 @@ def atlantic(version=None, gpath=None, rename_pyco2=True):
333
311
  gpath : str of None, optional
334
312
  Where to the downloaded file is or should be saved, by default `None`,
335
313
  in which case the file is imported from or saved at "~/.glodap".
336
- rename_pyco2 : bool, optional
337
- Whether to rename the columns to work with PyCO2SYS, by default `True`.
338
314
 
339
315
  Returns
340
316
  -------
@@ -345,11 +321,10 @@ def atlantic(version=None, gpath=None, rename_pyco2=True):
345
321
  region="atlantic",
346
322
  version=version,
347
323
  gpath=gpath,
348
- rename_pyco2=rename_pyco2,
349
324
  )
350
325
 
351
326
 
352
- def indian(version=None, gpath=None, rename_pyco2=True):
327
+ def indian(version=None, gpath=None):
353
328
  """Import the latest version of the GLODAP Indian Ocean dataset,
354
329
  downloading it first if it's not already available locally.
355
330
 
@@ -362,8 +337,6 @@ def indian(version=None, gpath=None, rename_pyco2=True):
362
337
  gpath : str of None, optional
363
338
  Where to the downloaded file is or should be saved, by default `None`,
364
339
  in which case the file is imported from or saved at "~/.glodap".
365
- rename_pyco2 : bool, optional
366
- Whether to rename the columns to work with PyCO2SYS, by default `True`.
367
340
 
368
341
  Returns
369
342
  -------
@@ -374,11 +347,10 @@ def indian(version=None, gpath=None, rename_pyco2=True):
374
347
  region="indian",
375
348
  version=version,
376
349
  gpath=gpath,
377
- rename_pyco2=rename_pyco2,
378
350
  )
379
351
 
380
352
 
381
- def pacific(version=None, gpath=None, rename_pyco2=True):
353
+ def pacific(version=None, gpath=None):
382
354
  """Import the latest version of the GLODAP Pacific Ocean dataset,
383
355
  downloading it first if it's not already available locally.
384
356
 
@@ -391,8 +363,6 @@ def pacific(version=None, gpath=None, rename_pyco2=True):
391
363
  gpath : str of None, optional
392
364
  Where to the downloaded file is or should be saved, by default `None`,
393
365
  in which case the file is imported from or saved at "~/.glodap".
394
- rename_pyco2 : bool, optional
395
- Whether to rename the columns to work with PyCO2SYS, by default `True`.
396
366
 
397
367
  Returns
398
368
  -------
@@ -403,11 +373,10 @@ def pacific(version=None, gpath=None, rename_pyco2=True):
403
373
  region="pacific",
404
374
  version=version,
405
375
  gpath=gpath,
406
- rename_pyco2=rename_pyco2,
407
376
  )
408
377
 
409
378
 
410
- def world(version=None, gpath=None, rename_pyco2=True):
379
+ def world(version=None, gpath=None):
411
380
  """Import the latest version of the GLODAP Merged Master File dataset,
412
381
  downloading it first if it's not already available locally.
413
382
 
@@ -420,8 +389,6 @@ def world(version=None, gpath=None, rename_pyco2=True):
420
389
  gpath : str of None, optional
421
390
  Where to the downloaded file is or should be saved, by default `None`,
422
391
  in which case the file is imported from or saved at "~/.glodap".
423
- rename_pyco2 : bool, optional
424
- Whether to rename the columns to work with PyCO2SYS, by default `True`.
425
392
 
426
393
  Returns
427
394
  -------
@@ -432,5 +399,4 @@ def world(version=None, gpath=None, rename_pyco2=True):
432
399
  region="world",
433
400
  version=version,
434
401
  gpath=gpath,
435
- rename_pyco2=rename_pyco2,
436
402
  )
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