xarray-selafin 0.2.2__tar.gz → 0.2.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.3
2
2
  Name: xarray-selafin
3
- Version: 0.2.2
3
+ Version: 0.2.3
4
4
  Summary:
5
5
  Author: tomsail
6
6
  Author-email: saillour.thomas@gmail.com
@@ -10,7 +10,7 @@ Classifier: Programming Language :: Python :: 3.11
10
10
  Classifier: Programming Language :: Python :: 3.12
11
11
  Classifier: Programming Language :: Python :: 3.13
12
12
  Requires-Dist: numpy
13
- Requires-Dist: python-serafin (==0.1.0)
13
+ Requires-Dist: python-serafin (>=0.2,<0.3)
14
14
  Requires-Dist: xarray
15
15
  Project-URL: Repository, https://github.com/oceanmodeling/xarray-selafin/
16
16
  Description-Content-Type: text/markdown
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "xarray-selafin"
3
- version = "0.2.2"
3
+ version = "0.2.3"
4
4
  description = ""
5
5
  authors = ["tomsail <saillour.thomas@gmail.com>", "lucduron <l.duron@cnr.tm.fr>"]
6
6
  readme = "README.md"
@@ -14,7 +14,7 @@ include = [
14
14
  python = ">=3.11"
15
15
  numpy = "*"
16
16
  xarray = "*"
17
- python-serafin = "0.1.0"
17
+ python-serafin = ">=0.2,<0.3"
18
18
 
19
19
  [tool.poetry.plugins."xarray.backends"]
20
20
  selafin = "xarray_selafin.xarray_backend:SelafinBackendEntrypoint"
@@ -34,5 +34,8 @@ requires = ["poetry-core"]
34
34
  build-backend = "poetry.core.masonry.api"
35
35
 
36
36
  [tool.black]
37
- target-version = ['py37']
37
+ target-version = ['py311']
38
38
  line-length = 107
39
+
40
+ [tool.ruff.isort]
41
+ force-single-line = true
@@ -11,17 +11,16 @@ from operator import attrgetter
11
11
 
12
12
  import numpy as np
13
13
  import xarray as xr
14
- from serafin import Read
15
14
  from serafin import SerafinHeader
15
+ from serafin import SerafinReader
16
16
  from serafin import SerafinRequestError
17
- from serafin import Write
17
+ from serafin import SerafinWriter
18
18
  from serafin.serafin import LANG
19
19
  from serafin.serafin import SLF_EIT
20
20
  from xarray.backends import BackendArray
21
21
  from xarray.backends import BackendEntrypoint
22
22
  from xarray.core import indexing
23
23
 
24
-
25
24
  try:
26
25
  import dask
27
26
 
@@ -47,7 +46,7 @@ def compute_duration_between_datetime(t0, time_serie):
47
46
 
48
47
 
49
48
  def read_serafin(filepath, lang):
50
- resin = Read(filepath, lang)
49
+ resin = SerafinReader(filepath, lang)
51
50
  resin.__enter__()
52
51
  resin.read_header()
53
52
  resin.get_time()
@@ -165,7 +164,7 @@ class SelafinBackendEntrypoint(BackendEntrypoint):
165
164
  nplan = slf.header.nb_planes
166
165
  x = slf.header.x
167
166
  y = slf.header.y
168
- vars = slf.header.var_IDs
167
+ vars = slf.header.var_ids
169
168
 
170
169
  # Create data variables
171
170
  data_vars = {}
@@ -322,10 +321,10 @@ class SelafinAccessor:
322
321
  header.add_variable_str(var, name, unit)
323
322
  except KeyError:
324
323
  try:
325
- header.add_variable_from_ID(var)
324
+ header.add_variable_from_id(var)
326
325
  except SerafinRequestError:
327
326
  header.add_variable_str(var, var, "?")
328
- header.nb_var = len(header.var_IDs)
327
+ header.nb_var = len(header.var_ids)
329
328
 
330
329
  if "plan" in ds.dims: # 3D
331
330
  header.is_2d = False
@@ -380,7 +379,7 @@ class SelafinAccessor:
380
379
  """Writes header and all data frames into output file"""
381
380
  header = self._header
382
381
 
383
- with Write(filepath, header.language, overwrite=True) as resout:
382
+ with SerafinWriter(filepath, header.language, overwrite=True) as resout:
384
383
  resout.write_header(header)
385
384
 
386
385
  t0 = np.datetime64(datetime(*header.date))
@@ -395,7 +394,7 @@ class SelafinAccessor:
395
394
  shape = (header.nb_var, header.nb_nodes)
396
395
  values = np.empty(shape, dtype=header.np_float_type)
397
396
  for time_index, time in enumerate(time_serie):
398
- for var_index, var in enumerate(header.var_IDs):
397
+ for var_index, var in enumerate(header.var_ids):
399
398
  if header.nb_frames in (0, 1):
400
399
  array = self._ds[var].values
401
400
  else:
File without changes