roms-tools 1.0.0__py3-none-any.whl → 1.1.0__py3-none-any.whl

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.
roms_tools/__init__.py CHANGED
@@ -11,6 +11,5 @@ except ImportError: # pragma: no cover
11
11
  from roms_tools.setup.grid import Grid # noqa: F401
12
12
  from roms_tools.setup.tides import TidalForcing # noqa: F401
13
13
  from roms_tools.setup.surface_forcing import SurfaceForcing # noqa: F401
14
- from roms_tools.setup.vertical_coordinate import VerticalCoordinate # noqa: F401
15
14
  from roms_tools.setup.initial_conditions import InitialConditions # noqa: F401
16
15
  from roms_tools.setup.boundary_forcing import BoundaryForcing # noqa: F401
roms_tools/_version.py CHANGED
@@ -1,2 +1,2 @@
1
1
  # Do not change! Do not track in version control!
2
- __version__ = "1.0.0"
2
+ __version__ = "1.1.0"
@@ -7,7 +7,6 @@ import importlib.metadata
7
7
  from typing import Dict, Union, Optional
8
8
  from dataclasses import dataclass, field, asdict
9
9
  from roms_tools.setup.grid import Grid
10
- from roms_tools.setup.vertical_coordinate import VerticalCoordinate
11
10
  from roms_tools.setup.mixins import ROMSToolsMixins
12
11
  from datetime import datetime
13
12
  from roms_tools.setup.datasets import GLORYSDataset, CESMBGCDataset
@@ -29,8 +28,6 @@ class BoundaryForcing(ROMSToolsMixins):
29
28
  ----------
30
29
  grid : Grid
31
30
  Object representing the grid information.
32
- vertical_coordinate: VerticalCoordinate
33
- Object representing the vertical coordinate information.
34
31
  start_time : datetime
35
32
  Start time of the desired boundary forcing data.
36
33
  end_time : datetime
@@ -59,7 +56,6 @@ class BoundaryForcing(ROMSToolsMixins):
59
56
  --------
60
57
  >>> boundary_forcing = BoundaryForcing(
61
58
  ... grid=grid,
62
- ... vertical_coordinate=vertical_coordinate,
63
59
  ... boundaries={"south": True, "east": True, "north": False, "west": True},
64
60
  ... start_time=datetime(2022, 1, 1),
65
61
  ... end_time=datetime(2022, 1, 2),
@@ -73,7 +69,6 @@ class BoundaryForcing(ROMSToolsMixins):
73
69
  """
74
70
 
75
71
  grid: Grid
76
- vertical_coordinate: VerticalCoordinate
77
72
  start_time: datetime
78
73
  end_time: datetime
79
74
  boundaries: Dict[str, bool] = field(
@@ -296,8 +291,8 @@ class BoundaryForcing(ROMSToolsMixins):
296
291
  def _write_into_datatree(self, data, bgc_data, d_meta, bdry_coords, rename):
297
292
 
298
293
  ds = self._add_global_metadata()
299
- ds["sc_r"] = self.vertical_coordinate.ds["sc_r"]
300
- ds["Cs_r"] = self.vertical_coordinate.ds["Cs_r"]
294
+ ds["sc_r"] = self.grid.ds["sc_r"]
295
+ ds["Cs_r"] = self.grid.ds["Cs_r"]
301
296
 
302
297
  ds = DataTree(name="root", data=ds)
303
298
 
@@ -333,12 +328,12 @@ class BoundaryForcing(ROMSToolsMixins):
333
328
  **bdry_coords["rho"][direction]
334
329
  ).rename(**rename["rho"][direction])
335
330
  layer_depth_rho = (
336
- self.vertical_coordinate.ds["layer_depth_rho"]
331
+ self.grid.ds["layer_depth_rho"]
337
332
  .isel(**bdry_coords["rho"][direction])
338
333
  .rename(**rename["rho"][direction])
339
334
  )
340
335
  interface_depth_rho = (
341
- self.vertical_coordinate.ds["interface_depth_rho"]
336
+ self.grid.ds["interface_depth_rho"]
342
337
  .isel(**bdry_coords["rho"][direction])
343
338
  .rename(**rename["rho"][direction])
344
339
  )
@@ -350,12 +345,12 @@ class BoundaryForcing(ROMSToolsMixins):
350
345
  **rename["u"][direction]
351
346
  )
352
347
  layer_depth_u = (
353
- self.vertical_coordinate.ds["layer_depth_u"]
348
+ self.grid.ds["layer_depth_u"]
354
349
  .isel(**bdry_coords["u"][direction])
355
350
  .rename(**rename["u"][direction])
356
351
  )
357
352
  interface_depth_u = (
358
- self.vertical_coordinate.ds["interface_depth_u"]
353
+ self.grid.ds["interface_depth_u"]
359
354
  .isel(**bdry_coords["u"][direction])
360
355
  .rename(**rename["u"][direction])
361
356
  )
@@ -367,12 +362,12 @@ class BoundaryForcing(ROMSToolsMixins):
367
362
  **rename["v"][direction]
368
363
  )
369
364
  layer_depth_v = (
370
- self.vertical_coordinate.ds["layer_depth_v"]
365
+ self.grid.ds["layer_depth_v"]
371
366
  .isel(**bdry_coords["v"][direction])
372
367
  .rename(**rename["v"][direction])
373
368
  )
374
369
  interface_depth_v = (
375
- self.vertical_coordinate.ds["interface_depth_v"]
370
+ self.grid.ds["interface_depth_v"]
376
371
  .isel(**bdry_coords["v"][direction])
377
372
  .rename(**rename["v"][direction])
378
373
  )
@@ -430,10 +425,9 @@ class BoundaryForcing(ROMSToolsMixins):
430
425
  ds.attrs["end_time"] = str(self.end_time)
431
426
  ds.attrs["model_reference_date"] = str(self.model_reference_date)
432
427
 
433
- ds.attrs["theta_s"] = self.vertical_coordinate.ds["theta_s"].item()
434
- ds.attrs["theta_b"] = self.vertical_coordinate.ds["theta_b"].item()
435
- ds.attrs["Tcline"] = self.vertical_coordinate.ds["Tcline"].item()
436
- ds.attrs["hc"] = self.vertical_coordinate.ds["hc"].item()
428
+ ds.attrs["theta_s"] = self.grid.ds.attrs["theta_s"]
429
+ ds.attrs["theta_b"] = self.grid.ds.attrs["theta_b"]
430
+ ds.attrs["hc"] = self.grid.ds.attrs["hc"]
437
431
 
438
432
  return ds
439
433
 
@@ -664,11 +658,6 @@ class BoundaryForcing(ROMSToolsMixins):
664
658
  grid_data.pop("ds", None) # Exclude non-serializable fields
665
659
  grid_data.pop("straddle", None)
666
660
 
667
- # Serialize VerticalCoordinate data
668
- vertical_coordinate_data = asdict(self.vertical_coordinate)
669
- vertical_coordinate_data.pop("ds", None) # Exclude non-serializable fields
670
- vertical_coordinate_data.pop("grid", None) # Exclude non-serializable fields
671
-
672
661
  # Include the version of roms-tools
673
662
  try:
674
663
  roms_tools_version = importlib.metadata.version("roms-tools")
@@ -679,7 +668,6 @@ class BoundaryForcing(ROMSToolsMixins):
679
668
  header = f"---\nroms_tools_version: {roms_tools_version}\n---\n"
680
669
 
681
670
  grid_yaml_data = {"Grid": grid_data}
682
- vertical_coordinate_yaml_data = {"VerticalCoordinate": vertical_coordinate_data}
683
671
 
684
672
  boundary_forcing_data = {
685
673
  "BoundaryForcing": {
@@ -694,7 +682,6 @@ class BoundaryForcing(ROMSToolsMixins):
694
682
 
695
683
  yaml_data = {
696
684
  **grid_yaml_data,
697
- **vertical_coordinate_yaml_data,
698
685
  **boundary_forcing_data,
699
686
  }
700
687
 
@@ -745,13 +732,10 @@ class BoundaryForcing(ROMSToolsMixins):
745
732
  boundary_forcing_data[date_string]
746
733
  )
747
734
 
748
- # Create VerticalCoordinate instance from the YAML file
749
- vertical_coordinate = VerticalCoordinate.from_yaml(filepath)
750
- grid = vertical_coordinate.grid
735
+ grid = Grid.from_yaml(filepath)
751
736
 
752
737
  # Create and return an instance of InitialConditions
753
738
  return cls(
754
739
  grid=grid,
755
- vertical_coordinate=vertical_coordinate,
756
740
  **boundary_forcing_data,
757
741
  )