eccodes 2.37.0__tar.gz → 2.38.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 (45) hide show
  1. {eccodes-2.37.0 → eccodes-2.38.0}/CHANGELOG.rst +8 -0
  2. {eccodes-2.37.0 → eccodes-2.38.0}/PKG-INFO +10 -2
  3. {eccodes-2.37.0 → eccodes-2.38.0}/README.rst +1 -1
  4. eccodes-2.38.0/ci/requirements-dev.txt +15 -0
  5. eccodes-2.38.0/ci/requirements-docs.in +3 -0
  6. eccodes-2.38.0/ci/requirements-docs.txt +48 -0
  7. eccodes-2.38.0/ci/requirements-tests.in +6 -0
  8. eccodes-2.38.0/ci/requirements-tests.txt +52 -0
  9. {eccodes-2.37.0 → eccodes-2.38.0}/eccodes/eccodes.py +12 -0
  10. {eccodes-2.37.0 → eccodes-2.38.0}/eccodes.egg-info/PKG-INFO +10 -2
  11. {eccodes-2.37.0 → eccodes-2.38.0}/eccodes.egg-info/SOURCES.txt +5 -0
  12. {eccodes-2.37.0 → eccodes-2.38.0}/gribapi/__init__.py +2 -2
  13. {eccodes-2.37.0 → eccodes-2.38.0}/gribapi/bindings.py +1 -2
  14. {eccodes-2.37.0 → eccodes-2.38.0}/gribapi/errors.py +1 -1
  15. {eccodes-2.37.0 → eccodes-2.38.0}/gribapi/grib_api.h +6 -1
  16. {eccodes-2.37.0 → eccodes-2.38.0}/gribapi/gribapi.py +50 -0
  17. {eccodes-2.37.0 → eccodes-2.38.0}/tests/test_eccodes.py +30 -3
  18. {eccodes-2.37.0 → eccodes-2.38.0}/.dockerignore +0 -0
  19. {eccodes-2.37.0 → eccodes-2.38.0}/CONTRIBUTING.rst +0 -0
  20. {eccodes-2.37.0 → eccodes-2.38.0}/Dockerfile +0 -0
  21. {eccodes-2.37.0 → eccodes-2.38.0}/LICENSE +0 -0
  22. {eccodes-2.37.0 → eccodes-2.38.0}/MANIFEST.in +0 -0
  23. {eccodes-2.37.0 → eccodes-2.38.0}/Makefile +0 -0
  24. {eccodes-2.37.0 → eccodes-2.38.0}/builder.py +0 -0
  25. {eccodes-2.37.0 → eccodes-2.38.0}/docs/_static/.gitkeep +0 -0
  26. {eccodes-2.37.0 → eccodes-2.38.0}/docs/conf.py +0 -0
  27. {eccodes-2.37.0 → eccodes-2.38.0}/docs/index.rst +0 -0
  28. {eccodes-2.37.0 → eccodes-2.38.0}/eccodes/__init__.py +0 -0
  29. {eccodes-2.37.0 → eccodes-2.38.0}/eccodes/__main__.py +0 -0
  30. {eccodes-2.37.0 → eccodes-2.38.0}/eccodes/highlevel/__init__.py +0 -0
  31. {eccodes-2.37.0 → eccodes-2.38.0}/eccodes/highlevel/message.py +0 -0
  32. {eccodes-2.37.0 → eccodes-2.38.0}/eccodes/highlevel/reader.py +0 -0
  33. {eccodes-2.37.0 → eccodes-2.38.0}/eccodes.egg-info/dependency_links.txt +0 -0
  34. {eccodes-2.37.0 → eccodes-2.38.0}/eccodes.egg-info/requires.txt +0 -0
  35. {eccodes-2.37.0 → eccodes-2.38.0}/eccodes.egg-info/top_level.txt +0 -0
  36. {eccodes-2.37.0 → eccodes-2.38.0}/eccodes.egg-info/zip-safe +0 -0
  37. {eccodes-2.37.0 → eccodes-2.38.0}/gribapi/eccodes.h +0 -0
  38. {eccodes-2.37.0 → eccodes-2.38.0}/setup.cfg +0 -0
  39. {eccodes-2.37.0 → eccodes-2.38.0}/setup.py +0 -0
  40. {eccodes-2.37.0 → eccodes-2.38.0}/tests/sample-data/era5-levels-members.grib +0 -0
  41. {eccodes-2.37.0 → eccodes-2.38.0}/tests/sample-data/tiggelam_cnmc_sfc.grib2 +0 -0
  42. {eccodes-2.37.0 → eccodes-2.38.0}/tests/test_20_main.py +0 -0
  43. {eccodes-2.37.0 → eccodes-2.38.0}/tests/test_20_messages.py +0 -0
  44. {eccodes-2.37.0 → eccodes-2.38.0}/tests/test_highlevel.py +0 -0
  45. {eccodes-2.37.0 → eccodes-2.38.0}/tox.ini +0 -0
@@ -2,11 +2,19 @@
2
2
  Changelog for eccodes-python
3
3
  ============================
4
4
 
5
+ 2.38.0 (2024-09-25)
6
+ --------------------
7
+
8
+ - ECC-1790: Add codes_get_offset
9
+ - ECC-1899: API function to allow setting debug level
10
+ - Function to query library features
11
+
5
12
  2.37.0 (2024-09-09)
6
13
  -------------------
7
14
 
8
15
  - bundle ecCodes binary library with the PyPi distribution, for Linux and MacOS
9
16
 
17
+
10
18
  1.7.1 (2024-06-19)
11
19
  --------------------
12
20
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: eccodes
3
- Version: 2.37.0
3
+ Version: 2.38.0
4
4
  Summary: Python interface to the ecCodes GRIB and BUFR decoder/encoder
5
5
  Home-page: https://github.com/ecmwf/eccodes-python
6
6
  Author: European Centre for Medium-Range Weather Forecasts (ECMWF)
@@ -53,7 +53,7 @@ Installation
53
53
  follow the version numbering of the ecCodes binary library. See below for details.**
54
54
 
55
55
 
56
- The package is installed from PyPI with::
56
+ The package can be installed from PyPI with::
57
57
 
58
58
  $ pip install eccodes
59
59
 
@@ -179,11 +179,19 @@ does it submit to any jurisdiction.
179
179
  Changelog for eccodes-python
180
180
  ============================
181
181
 
182
+ 2.38.0 (2024-09-25)
183
+ --------------------
184
+
185
+ - ECC-1790: Add codes_get_offset
186
+ - ECC-1899: API function to allow setting debug level
187
+ - Function to query library features
188
+
182
189
  2.37.0 (2024-09-09)
183
190
  -------------------
184
191
 
185
192
  - bundle ecCodes binary library with the PyPi distribution, for Linux and MacOS
186
193
 
194
+
187
195
  1.7.1 (2024-06-19)
188
196
  --------------------
189
197
 
@@ -28,7 +28,7 @@ Installation
28
28
  follow the version numbering of the ecCodes binary library. See below for details.**
29
29
 
30
30
 
31
- The package is installed from PyPI with::
31
+ The package can be installed from PyPI with::
32
32
 
33
33
  $ pip install eccodes
34
34
 
@@ -0,0 +1,15 @@
1
+ check-manifest
2
+ detox
3
+ IPython
4
+ matplotlib
5
+ notebook
6
+ pip-tools
7
+ pyroma
8
+ pytest-mypy
9
+ setuptools
10
+ tox
11
+ tox-pyenv
12
+ wheel
13
+ zest.releaser
14
+ black
15
+
@@ -0,0 +1,3 @@
1
+ Sphinx
2
+ pytest-runner
3
+
@@ -0,0 +1,48 @@
1
+ #
2
+ # This file is autogenerated by pip-compile
3
+ # To update, run:
4
+ #
5
+ # pip-compile --output-file ci/requirements-docs.txt setup.py ci/requirements-docs.in
6
+ #
7
+ alabaster==0.7.12
8
+ # via sphinx
9
+ babel==2.9.1
10
+ # via sphinx
11
+ certifi==2024.7.4
12
+ # via requests
13
+ charset-normalizer==3.3.2
14
+ # via requests
15
+ docutils==0.14
16
+ # via sphinx
17
+ idna==3.7
18
+ # via requests
19
+ imagesize==1.1.0
20
+ # via sphinx
21
+ jinja2==3.1.4
22
+ # via sphinx
23
+ markupsafe==2.1.5
24
+ # via jinja2
25
+ packaging==19.0
26
+ # via sphinx
27
+ pygments==2.15.0
28
+ # via sphinx
29
+ pyparsing==2.3.1
30
+ # via packaging
31
+ pytest-runner==4.4
32
+ # via -r requirements-docs.in
33
+ pytz==2018.9
34
+ # via babel
35
+ requests==2.32.2
36
+ # via sphinx
37
+ six==1.12.0
38
+ # via
39
+ # packaging
40
+ # sphinx
41
+ snowballstemmer==1.2.1
42
+ # via sphinx
43
+ sphinx==1.8.5
44
+ # via -r requirements-docs.in
45
+ sphinxcontrib-websupport==1.1.0
46
+ # via sphinx
47
+ urllib3==1.26.19
48
+ # via requests
@@ -0,0 +1,6 @@
1
+ pytest
2
+ pytest-cov
3
+ pytest-flakes
4
+ pytest-mccabe
5
+ pytest-pep8
6
+ pytest-runner
@@ -0,0 +1,52 @@
1
+ #
2
+ # This file is autogenerated by pip-compile
3
+ # To update, run:
4
+ #
5
+ # pip-compile --output-file ci/requirements-tests.txt setup.py ci/requirements-tests.in
6
+ #
7
+ apipkg==1.5
8
+ # via execnet
9
+ atomicwrites==1.3.0
10
+ # via pytest
11
+ attrs==19.1.0
12
+ # via pytest
13
+ coverage==4.5.3
14
+ # via pytest-cov
15
+ execnet==1.5.0
16
+ # via pytest-cache
17
+ mccabe==0.6.1
18
+ # via pytest-mccabe
19
+ more-itertools==5.0.0
20
+ # via pytest
21
+ pep8==1.7.1
22
+ # via pytest-pep8
23
+ pluggy==0.9.0
24
+ # via pytest
25
+ pyflakes==2.1.1
26
+ # via pytest-flakes
27
+ pytest==4.3.1
28
+ # via
29
+ # -r requirements-tests.in
30
+ # pytest-cache
31
+ # pytest-cov
32
+ # pytest-flakes
33
+ # pytest-mccabe
34
+ # pytest-pep8
35
+ pytest-cache==1.0
36
+ # via
37
+ # pytest-mccabe
38
+ # pytest-pep8
39
+ pytest-cov==2.6.1
40
+ # via -r requirements-tests.in
41
+ pytest-flakes==4.0.0
42
+ # via -r requirements-tests.in
43
+ pytest-mccabe==0.1
44
+ # via -r requirements-tests.in
45
+ pytest-pep8==1.0.6
46
+ # via -r requirements-tests.in
47
+ pytest-runner==4.4
48
+ # via -r requirements-tests.in
49
+ six==1.12.0
50
+ # via
51
+ # more-itertools
52
+ # pytest
@@ -10,6 +10,9 @@
10
10
  #
11
11
  #
12
12
  from gribapi import (
13
+ CODES_FEATURES_ALL,
14
+ CODES_FEATURES_DISABLED,
15
+ CODES_FEATURES_ENABLED,
13
16
  CODES_PRODUCT_ANY,
14
17
  CODES_PRODUCT_BUFR,
15
18
  CODES_PRODUCT_GRIB,
@@ -44,6 +47,7 @@ from gribapi import (
44
47
  codes_dump,
45
48
  codes_extract_offsets,
46
49
  codes_extract_offsets_sizes,
50
+ codes_get_features,
47
51
  codes_get_gaussian_latitudes,
48
52
  codes_get_library_path,
49
53
  codes_get_version_info,
@@ -73,6 +77,7 @@ from gribapi import grib_get_message as codes_get_message
73
77
  from gribapi import grib_get_message_offset as codes_get_message_offset
74
78
  from gribapi import grib_get_message_size as codes_get_message_size
75
79
  from gribapi import grib_get_native_type as codes_get_native_type
80
+ from gribapi import grib_get_offset as codes_get_offset
76
81
  from gribapi import grib_get_size as codes_get_size
77
82
  from gribapi import grib_get_string as codes_get_string
78
83
  from gribapi import grib_get_string_array as codes_get_string_array
@@ -123,6 +128,7 @@ from gribapi import grib_no_fail_on_wrong_length as codes_no_fail_on_wrong_lengt
123
128
  from gribapi import grib_release as codes_release
124
129
  from gribapi import grib_set as codes_set
125
130
  from gribapi import grib_set_array as codes_set_array
131
+ from gribapi import grib_set_debug as codes_set_debug
126
132
  from gribapi import grib_set_definitions_path as codes_set_definitions_path
127
133
  from gribapi import grib_set_double as codes_set_double
128
134
  from gribapi import grib_set_double_array as codes_set_double_array
@@ -247,6 +253,9 @@ __all__ = [
247
253
  "codes_definition_path",
248
254
  "codes_extract_offsets",
249
255
  "codes_extract_offsets_sizes",
256
+ "CODES_FEATURES_ALL",
257
+ "CODES_FEATURES_ENABLED",
258
+ "CODES_FEATURES_DISABLED",
250
259
  "codes_get_api_version",
251
260
  "codes_get_array",
252
261
  "codes_get_double_array",
@@ -263,6 +272,7 @@ __all__ = [
263
272
  "codes_get_message_size",
264
273
  "codes_get_message",
265
274
  "codes_get_native_type",
275
+ "codes_get_offset",
266
276
  "codes_get_size",
267
277
  "codes_get_string_array",
268
278
  "codes_get_string_length",
@@ -270,6 +280,7 @@ __all__ = [
270
280
  "codes_get_values",
271
281
  "codes_get_version_info",
272
282
  "codes_get",
283
+ "codes_get_features",
273
284
  "codes_grib_find_nearest_multiple",
274
285
  "codes_grib_find_nearest",
275
286
  "codes_grib_get_data",
@@ -333,6 +344,7 @@ __all__ = [
333
344
  "codes_samples_path",
334
345
  "codes_dump",
335
346
  "codes_set_array",
347
+ "codes_set_debug",
336
348
  "codes_set_definitions_path",
337
349
  "codes_set_double_array",
338
350
  "codes_set_double",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: eccodes
3
- Version: 2.37.0
3
+ Version: 2.38.0
4
4
  Summary: Python interface to the ecCodes GRIB and BUFR decoder/encoder
5
5
  Home-page: https://github.com/ecmwf/eccodes-python
6
6
  Author: European Centre for Medium-Range Weather Forecasts (ECMWF)
@@ -53,7 +53,7 @@ Installation
53
53
  follow the version numbering of the ecCodes binary library. See below for details.**
54
54
 
55
55
 
56
- The package is installed from PyPI with::
56
+ The package can be installed from PyPI with::
57
57
 
58
58
  $ pip install eccodes
59
59
 
@@ -179,11 +179,19 @@ does it submit to any jurisdiction.
179
179
  Changelog for eccodes-python
180
180
  ============================
181
181
 
182
+ 2.38.0 (2024-09-25)
183
+ --------------------
184
+
185
+ - ECC-1790: Add codes_get_offset
186
+ - ECC-1899: API function to allow setting debug level
187
+ - Function to query library features
188
+
182
189
  2.37.0 (2024-09-09)
183
190
  -------------------
184
191
 
185
192
  - bundle ecCodes binary library with the PyPi distribution, for Linux and MacOS
186
193
 
194
+
187
195
  1.7.1 (2024-06-19)
188
196
  --------------------
189
197
 
@@ -10,6 +10,11 @@ builder.py
10
10
  setup.cfg
11
11
  setup.py
12
12
  tox.ini
13
+ ci/requirements-dev.txt
14
+ ci/requirements-docs.in
15
+ ci/requirements-docs.txt
16
+ ci/requirements-tests.in
17
+ ci/requirements-tests.txt
13
18
  docs/conf.py
14
19
  docs/index.rst
15
20
  docs/_static/.gitkeep
@@ -14,8 +14,8 @@ from .gribapi import * # noqa
14
14
  from .gribapi import __version__, lib
15
15
 
16
16
  # The minimum recommended version for the ecCodes package
17
- min_recommended_version_str = "2.37.0"
18
- min_recommended_version_int = 23700
17
+ min_recommended_version_str = "2.38.0"
18
+ min_recommended_version_int = 23800
19
19
 
20
20
  if lib.grib_get_api_version() < min_recommended_version_int:
21
21
  import warnings
@@ -23,7 +23,7 @@ import sys
23
23
 
24
24
  import cffi
25
25
 
26
- __version__ = "2.37.0"
26
+ __version__ = "2.38.0"
27
27
 
28
28
  LOG = logging.getLogger(__name__)
29
29
 
@@ -48,7 +48,6 @@ def _lookup(name):
48
48
 
49
49
 
50
50
  def find_binary_libs(name):
51
-
52
51
  name = _lookup(name)
53
52
  env_var = "ECCODES_PYTHON_USE_FINDLIBS"
54
53
  if int(os.environ.get(env_var, "0")):
@@ -26,7 +26,7 @@ class GribInternalError(Exception):
26
26
  def __init__(self, value):
27
27
  # Call the base class constructor with the parameters it needs
28
28
  Exception.__init__(self, value)
29
- if type(value) is int:
29
+ if isinstance(value, int):
30
30
  self.msg = ffi.string(lib.grib_get_error_message(value)).decode(ENC)
31
31
  else:
32
32
  self.msg = value
@@ -100,6 +100,7 @@ int grib_nearest_find_multiple(const grib_handle* h, int is_lsm,
100
100
  double* outlats, double* outlons,
101
101
  double* values, double* distances, int* indexes);
102
102
 
103
+ int grib_get_offset(const grib_handle* h, const char* key, size_t* offset);
103
104
  int grib_get_size(const grib_handle* h, const char* key,size_t *size);
104
105
 
105
106
  int grib_get_length(const grib_handle* h, const char* key,size_t *length);
@@ -107,7 +108,7 @@ int grib_get_long(const grib_handle* h, const char* key, long* value);
107
108
  int grib_get_double(const grib_handle* h, const char* key, double* value);
108
109
  int grib_get_double_element(const grib_handle* h, const char* key, int i, double* value);
109
110
  int grib_get_double_elements(const grib_handle* h, const char* key, const int* index_array, long size, double* value);
110
- int grib_get_string(const grib_handle* h, const char* key, char* mesg, size_t *length);
111
+ int grib_get_string(const grib_handle* h, const char* key, char* value, size_t *length);
111
112
  int grib_get_string_array(const grib_handle* h, const char* key, char** vals, size_t *length);
112
113
  int grib_get_double_array(const grib_handle* h, const char* key, double* vals, size_t *length);
113
114
  int grib_get_float_array(const grib_handle* h, const char* key, float* vals, size_t *length);
@@ -131,6 +132,7 @@ void grib_gts_header_off(grib_context* c);
131
132
  void grib_gribex_mode_on(grib_context* c);
132
133
  void grib_gribex_mode_off(grib_context* c);
133
134
  void grib_context_set_definitions_path(grib_context* c, const char* path);
135
+ void grib_context_set_debug(grib_context* c, int mode);
134
136
  void grib_context_set_samples_path(grib_context* c, const char* path);
135
137
  void grib_multi_support_on(grib_context* c);
136
138
  void grib_multi_support_off(grib_context* c);
@@ -174,6 +176,9 @@ int parse_keyval_string(const char *grib_tool, char *arg, int values_required, i
174
176
  int grib_get_data(const grib_handle *h, double *lats, double *lons, double *values);
175
177
  int grib_get_gaussian_latitudes(long trunc, double* lats);
176
178
 
179
+ int codes_is_feature_enabled(const char* feature);
180
+ int codes_get_features(char* result, size_t* length, int select);
181
+
177
182
  /* EXPERIMENTAL */
178
183
  typedef struct codes_bufr_header {
179
184
  unsigned long message_offset;
@@ -70,6 +70,12 @@ GRIB_NEAREST_SAME_GRID = 1 << 0
70
70
  GRIB_NEAREST_SAME_DATA = 1 << 1
71
71
  GRIB_NEAREST_SAME_POINT = 1 << 2
72
72
 
73
+ # Constants for feature selection
74
+ CODES_FEATURES_ALL = 0
75
+ CODES_FEATURES_ENABLED = 1
76
+ CODES_FEATURES_DISABLED = 2
77
+
78
+
73
79
  # ECC-1029: Disable function-arguments type-checking unless
74
80
  # environment variable is defined and equal to 1
75
81
  enable_type_checks = os.environ.get("ECCODES_PYTHON_ENABLE_TYPE_CHECKS") == "1"
@@ -578,6 +584,23 @@ def grib_multi_append(ingribid, startsection, multigribid):
578
584
  GRIB_CHECK(lib.grib_multi_handle_append(h, startsection, mh))
579
585
 
580
586
 
587
+ @require(msgid=int, key=str)
588
+ def grib_get_offset(msgid, key):
589
+ """
590
+ @brief Get the byte offset of a key. If several keys of the same name
591
+ are present, the offset of the last one is returned
592
+
593
+ @param msgid id of the message loaded in memory
594
+ @param key name of the key
595
+ @exception CodesInternalError
596
+ """
597
+ h = get_handle(msgid)
598
+ offset_p = ffi.new("size_t*")
599
+ err = lib.grib_get_offset(h, key.encode(ENC), offset_p)
600
+ GRIB_CHECK(err)
601
+ return offset_p[0]
602
+
603
+
581
604
  @require(msgid=int, key=str)
582
605
  def grib_get_size(msgid, key):
583
606
  """
@@ -2405,6 +2428,16 @@ def codes_samples_path():
2405
2428
  return ffi.string(spath).decode(ENC)
2406
2429
 
2407
2430
 
2431
+ def grib_set_debug(dmode):
2432
+ """
2433
+ @brief Set the debug mode
2434
+
2435
+ @param dmode -1, 0 or 1
2436
+ """
2437
+ context = lib.grib_context_get_default()
2438
+ lib.grib_context_set_debug(context, dmode)
2439
+
2440
+
2408
2441
  @require(defs_path=str)
2409
2442
  def grib_set_definitions_path(defs_path):
2410
2443
  """
@@ -2617,6 +2650,23 @@ def codes_extract_offsets_sizes(filepath, product_kind, is_strict=True):
2617
2650
  i += 1
2618
2651
 
2619
2652
 
2653
+ @require(select=int)
2654
+ def codes_get_features(select=CODES_FEATURES_ALL):
2655
+ """
2656
+ @brief Get the list of library features.
2657
+
2658
+ @param select One of CODES_FEATURES_ALL, CODES_FEATURES_ENABLED or CODES_FEATURES_DISABLED
2659
+ @return space-separated string of feature names
2660
+ @exception CodesInternalError
2661
+ """
2662
+ ssize = 1024
2663
+ result = ffi.new("char[]", ssize)
2664
+ size_p = ffi.new("size_t *", ssize)
2665
+ err = lib.codes_get_features(result, size_p, select)
2666
+ GRIB_CHECK(err)
2667
+ return ffi.string(result).decode(ENC)
2668
+
2669
+
2620
2670
  # -------------------------------
2621
2671
  # EXPERIMENTAL FEATURES
2622
2672
  # -------------------------------
@@ -48,6 +48,13 @@ def test_codes_samples_path():
48
48
  assert sp is not None
49
49
 
50
50
 
51
+ def test_codes_set_debug():
52
+ if eccodes.codes_get_api_version(int) < 23800:
53
+ pytest.skip("ecCodes version too old")
54
+ eccodes.codes_set_debug(-1)
55
+ eccodes.codes_set_debug(0)
56
+
57
+
51
58
  def test_codes_set_definitions_path():
52
59
  eccodes.codes_set_definitions_path(eccodes.codes_definition_path())
53
60
 
@@ -58,11 +65,11 @@ def test_codes_set_samples_path():
58
65
 
59
66
  def test_api_version():
60
67
  vs = eccodes.codes_get_api_version()
61
- assert type(vs) is str
68
+ assert isinstance(vs, str)
62
69
  assert len(vs) > 0
63
70
  assert vs == eccodes.codes_get_api_version(str)
64
71
  vi = eccodes.codes_get_api_version(int)
65
- assert type(vi) is int
72
+ assert isinstance(vi, int)
66
73
  assert vi > 20000
67
74
  print(vi)
68
75
 
@@ -73,6 +80,18 @@ def test_version_info():
73
80
  assert len(vinfo) == 2
74
81
 
75
82
 
83
+ def test_codes_get_features():
84
+ if eccodes.codes_get_api_version(int) < 23800:
85
+ pytest.skip("ecCodes version too old")
86
+
87
+ features = eccodes.codes_get_features(eccodes.CODES_FEATURES_ALL)
88
+ print(f"\n\tAll features = {features}")
89
+ features = eccodes.codes_get_features(eccodes.CODES_FEATURES_DISABLED)
90
+ print(f"\tDisabled features = {features}")
91
+ features = eccodes.codes_get_features(eccodes.CODES_FEATURES_ENABLED)
92
+ print(f"\tEnabled features = {features}")
93
+
94
+
76
95
  def test_codes_is_defined():
77
96
  gid = eccodes.codes_grib_new_from_samples("sh_sfc_grib1")
78
97
  assert eccodes.codes_is_defined(gid, "JS")
@@ -358,6 +377,14 @@ def test_grib_get_message_offset():
358
377
  assert eccodes.codes_get_message_offset(gid) == 0
359
378
 
360
379
 
380
+ def test_grib_get_key_offset():
381
+ gid = eccodes.codes_grib_new_from_samples("GRIB2")
382
+ assert eccodes.codes_get_offset(gid, "identifier") == 0
383
+ assert eccodes.codes_get_offset(gid, "discipline") == 6
384
+ assert eccodes.codes_get_offset(gid, "offsetSection1") == 16
385
+ assert eccodes.codes_get_offset(gid, "7777") == 175
386
+
387
+
361
388
  def test_grib_clone():
362
389
  gid = eccodes.codes_grib_new_from_samples("GRIB2")
363
390
  clone = eccodes.codes_clone(gid)
@@ -725,7 +752,7 @@ def test_grib_uuid_get_set():
725
752
  eccodes.codes_set(gid, "gridType", "unstructured_grid")
726
753
  key = "uuidOfHGrid"
727
754
  ntype = eccodes.codes_get_native_type(gid, key)
728
- assert ntype == bytes
755
+ assert ntype is bytes
729
756
 
730
757
  uuid = eccodes.codes_get_string(gid, key)
731
758
  assert uuid == "00000000000000000000000000000000"
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