Skip to content

Commit

Permalink
SIMA 4.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
lassebje committed Jun 18, 2024
1 parent 7991d94 commit 886d065
Show file tree
Hide file tree
Showing 167 changed files with 3,031 additions and 851 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

setup(
name="simapy",
version="4.6.1.dev2",
version="4.8.0.dev0",
author="SINTEF Ocean",
description="Python utilities for SIMA",
url="https://github.com/SINTEF/simapy",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ def __init__(self, name="ExportBlueprintCommand", package_path="sima/command", d
self.add_attribute(Attribute("name","string",""))
self.add_attribute(BlueprintAttribute("parameters","sima/sima/Property","Additional parameters",True,Dimension("*")))
self.add_attribute(Attribute("output","string","Optional output directory. If not specified the blueprints will be imported into the current workspace"))
self.add_attribute(Attribute("versions","boolean","Write package version files",default=False))
self.add_attribute(Attribute("delete","boolean","Delete the content of the output folder before exporting",default=False))
24 changes: 12 additions & 12 deletions src/simapy/sima/command/exportblueprintcommand.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,18 @@ class ExportBlueprintCommand(Command):
Additional parameters
output : str
Optional output directory. If not specified the blueprints will be imported into the current workspace(default None)
versions : bool
Write package version files(default False)
delete : bool
Delete the content of the output folder before exporting(default False)
"""

def __init__(self , description="", versions=False, **kwargs):
def __init__(self , description="", delete=False, **kwargs):
super().__init__(**kwargs)
self.description = description
self.scriptableValues = list()
self.name = None
self.parameters = list()
self.output = None
self.versions = versions
self.delete = delete
for key, value in kwargs.items():
if not isinstance(value, Dict):
setattr(self, key, value)
Expand Down Expand Up @@ -100,11 +100,11 @@ def output(self, value: str):
self.__output = value

@property
def versions(self) -> bool:
"""Write package version files"""
return self.__versions

@versions.setter
def versions(self, value: bool):
"""Set versions"""
self.__versions = bool(value)
def delete(self) -> bool:
"""Delete the content of the output folder before exporting"""
return self.__delete

@delete.setter
def delete(self, value: bool):
"""Set delete"""
self.__delete = bool(value)
2 changes: 1 addition & 1 deletion src/simapy/sima/environment/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
from .fluctuatingtwocomponent import FluctuatingTwoComponent # noqa
from .fluctuatingwindvelocityprofile import FluctuatingWindVelocityProfile # noqa
from .harris import Harris # noqa
from .iso199011wind import ISO199011Wind # noqa
from .jonswap import Jonswap # noqa
from .jonswap3p import Jonswap3P # noqa
from .jonswap6p import Jonswap6P # noqa
from .jonswapdoublepeaked import JonswapDoublePeaked # noqa
from .npdwind import NPDWind # noqa
from .numericalwave import NumericalWave # noqa
from .ochi import Ochi # noqa
from .piersonmoskowitz import PiersonMoskowitz # noqa
Expand Down
5 changes: 3 additions & 2 deletions src/simapy/sima/environment/blueprints/esduwind.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ def __init__(self, name="ESDUWind", package_path="sima/environment", description
self.add_attribute(BlueprintAttribute("scriptableValues","sima/sima/ScriptableValue","",True,Dimension("*")))
self.add_attribute(Attribute("direction","number","Wind propagation direction",default=0.0))
self.add_attribute(Attribute("averageVelocity","number","Average velocity at reference height",default=0.0))
self.add_attribute(Attribute("psi","number","Site latitude in decimal degrees",default=0.0))
self.add_attribute(Attribute("friction","number","Surface drag coefficient used for transverse gust spectrum",default=0.002))
self.add_attribute(Attribute("profileExponent","number","Wind profile exponent",default=0.11))
self.add_attribute(Attribute("friction","number","Surface drag coefficient.\nAlso used for transverse gust spectrum, if specified.",default=0.002))
self.add_attribute(Attribute("psi","number","Site latitude in decimal degrees",default=0.0))
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
#
# Generated with NPDWindBlueprint
# Generated with ISO199011WindBlueprint
from dmt.blueprint import Blueprint
from dmt.dimension import Dimension
from dmt.attribute import Attribute
from dmt.enum_attribute import EnumAttribute
from dmt.blueprint_attribute import BlueprintAttribute
from .wind import WindBlueprint

class NPDWindBlueprint(WindBlueprint):
class ISO199011WindBlueprint(WindBlueprint):
""""""

def __init__(self, name="NPDWind", package_path="sima/environment", description=""):
def __init__(self, name="ISO199011Wind", package_path="sima/environment", description=""):
super().__init__(name,package_path,description)
self.add_attribute(Attribute("description","string","",default=""))
self.add_attribute(BlueprintAttribute("scriptableValues","sima/sima/ScriptableValue","",True,Dimension("*")))
Expand Down
4 changes: 3 additions & 1 deletion src/simapy/sima/environment/blueprints/numericalwave.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ def __init__(self, name="NumericalWave", package_path="sima/environment", descri
super().__init__(name,package_path,description)
self.add_attribute(Attribute("description","string","",default=""))
self.add_attribute(BlueprintAttribute("scriptableValues","sima/sima/ScriptableValue","",True,Dimension("*")))
self.add_attribute(Attribute("fromFile","boolean","Define numerical spectrum in external file",default=False))
self.add_attribute(Attribute("directions","number","Number of wave directions",Dimension("*"),default=0.0))
self.add_attribute(Attribute("frequencies","number","Number of wave frequencies",Dimension("*"),default=0.0))
self.add_attribute(Attribute("values","number","",Dimension("*"),default=0.0))
self.add_attribute(Attribute("values","number","",Dimension("*"),default=0.0))
self.add_attribute(Attribute("file","string","Name of external file with specified numerical spectrum data"))
38 changes: 26 additions & 12 deletions src/simapy/sima/environment/esduwind.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,23 @@ class ESDUWind(Wind):
Wind propagation direction(default 0.0)
averageVelocity : float
Average velocity at reference height(default 0.0)
profileExponent : float
Wind profile exponent(default 0.11)
friction : float
Surface drag coefficient.\nAlso used for transverse gust spectrum, if specified.(default 0.002)
psi : float
Site latitude in decimal degrees(default 0.0)
friction : float
Surface drag coefficient used for transverse gust spectrum(default 0.002)
"""

def __init__(self , description="", direction=0.0, averageVelocity=0.0, psi=0.0, friction=0.002, **kwargs):
def __init__(self , description="", direction=0.0, averageVelocity=0.0, profileExponent=0.11, friction=0.002, psi=0.0, **kwargs):
super().__init__(**kwargs)
self.description = description
self.scriptableValues = list()
self.direction = direction
self.averageVelocity = averageVelocity
self.psi = psi
self.profileExponent = profileExponent
self.friction = friction
self.psi = psi
for key, value in kwargs.items():
if not isinstance(value, Dict):
setattr(self, key, value)
Expand Down Expand Up @@ -87,21 +90,32 @@ def averageVelocity(self, value: float):
self.__averageVelocity = float(value)

@property
def psi(self) -> float:
"""Site latitude in decimal degrees"""
return self.__psi
def profileExponent(self) -> float:
"""Wind profile exponent"""
return self.__profileExponent

@psi.setter
def psi(self, value: float):
"""Set psi"""
self.__psi = float(value)
@profileExponent.setter
def profileExponent(self, value: float):
"""Set profileExponent"""
self.__profileExponent = float(value)

@property
def friction(self) -> float:
"""Surface drag coefficient used for transverse gust spectrum"""
"""Surface drag coefficient.
Also used for transverse gust spectrum, if specified."""
return self.__friction

@friction.setter
def friction(self, value: float):
"""Set friction"""
self.__friction = float(value)

@property
def psi(self) -> float:
"""Site latitude in decimal degrees"""
return self.__psi

@psi.setter
def psi(self, value: float):
"""Set psi"""
self.__psi = float(value)
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# This an autogenerated file
#
# Generated with NPDWind
# Generated with ISO199011Wind
from typing import Dict,Sequence,List
from dmt.blueprint import Blueprint
from .blueprints.npdwind import NPDWindBlueprint
from .blueprints.iso199011wind import ISO199011WindBlueprint
from typing import Dict
from ..sima import ScriptableValue
from .wind import Wind

class NPDWind(Wind):
class ISO199011Wind(Wind):
"""
Keyword arguments
-----------------
Expand Down Expand Up @@ -44,7 +44,7 @@ def __init__(self , description="", direction=0.0, averageVelocity=0.0, profileE
@property
def blueprint(self) -> Blueprint:
"""Return blueprint that this entity represents"""
return NPDWindBlueprint()
return ISO199011WindBlueprint()


@property
Expand Down
28 changes: 27 additions & 1 deletion src/simapy/sima/environment/numericalwave.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,26 @@ class NumericalWave(Wave):
description : str
(default "")
scriptableValues : List[ScriptableValue]
fromFile : bool
Define numerical spectrum in external file(default False)
directions : ndarray of float
Number of wave directions
frequencies : ndarray of float
Number of wave frequencies
values : ndarray of float
file : str
Name of external file with specified numerical spectrum data(default None)
"""

def __init__(self , description="", **kwargs):
def __init__(self , description="", fromFile=False, **kwargs):
super().__init__(**kwargs)
self.description = description
self.scriptableValues = list()
self.fromFile = fromFile
self.directions = []
self.frequencies = []
self.values = []
self.file = None
for key, value in kwargs.items():
if not isinstance(value, Dict):
setattr(self, key, value)
Expand Down Expand Up @@ -62,6 +68,16 @@ def scriptableValues(self, value: List[ScriptableValue]):
raise ValueError("Expected sequense, but was " , type(value))
self.__scriptableValues = value

@property
def fromFile(self) -> bool:
"""Define numerical spectrum in external file"""
return self.__fromFile

@fromFile.setter
def fromFile(self, value: bool):
"""Set fromFile"""
self.__fromFile = bool(value)

@property
def directions(self) -> ndarray:
"""Number of wave directions"""
Expand Down Expand Up @@ -100,3 +116,13 @@ def values(self, value: ndarray):
if len(array) > 0 and array.ndim != 1:
raise ValueError("Expected array with 1 dimensions")
self.__values = array

@property
def file(self) -> str:
"""Name of external file with specified numerical spectrum data"""
return self.__file

@file.setter
def file(self, value: str):
"""Set file"""
self.__file = value
2 changes: 2 additions & 0 deletions src/simapy/sima/graph/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@

from .nodeinputslot import NodeInputSlot # noqa
from .nodeoutputslot import NodeOutputSlot # noqa
from .point import Point # noqa
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
#
# Generated with FormulaBlueprint
# Generated with NodeInputSlotBlueprint
from dmt.blueprint import Blueprint
from dmt.dimension import Dimension
from dmt.attribute import Attribute
from dmt.enum_attribute import EnumAttribute
from dmt.blueprint_attribute import BlueprintAttribute
from .reportitem import ReportItemBlueprint
from ...sima.blueprints.named import NamedBlueprint

class FormulaBlueprint(ReportItemBlueprint):
class NodeInputSlotBlueprint(NamedBlueprint):
""""""

def __init__(self, name="Formula", package_path="sima/report", description=""):
def __init__(self, name="NodeInputSlot", package_path="sima/graph", description=""):
super().__init__(name,package_path,description)
self.add_attribute(Attribute("description","string","",default=""))
self.add_attribute(BlueprintAttribute("scriptableValues","sima/sima/ScriptableValue","",True,Dimension("*")))
self.add_attribute(Attribute("latex","string",""))
self.add_attribute(Attribute("caption","string","Caption"))
self.add_attribute(Attribute("name","string",""))
17 changes: 17 additions & 0 deletions src/simapy/sima/graph/blueprints/nodeoutputslot.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#
# Generated with NodeOutputSlotBlueprint
from dmt.blueprint import Blueprint
from dmt.dimension import Dimension
from dmt.attribute import Attribute
from dmt.enum_attribute import EnumAttribute
from dmt.blueprint_attribute import BlueprintAttribute
from ...sima.blueprints.named import NamedBlueprint

class NodeOutputSlotBlueprint(NamedBlueprint):
""""""

def __init__(self, name="NodeOutputSlot", package_path="sima/graph", description=""):
super().__init__(name,package_path,description)
self.add_attribute(Attribute("description","string","",default=""))
self.add_attribute(BlueprintAttribute("scriptableValues","sima/sima/ScriptableValue","",True,Dimension("*")))
self.add_attribute(Attribute("name","string",""))
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
# This an autogenerated file
#
# Generated with Linkable
# Generated with NodeInputSlot
from typing import Dict,Sequence,List
from dmt.blueprint import Blueprint
from .blueprints.linkable import LinkableBlueprint
from .blueprints.nodeinputslot import NodeInputSlotBlueprint
from typing import Dict
from ..sima import MOAO
from ..sima import Named
from ..sima import ScriptableValue

class Linkable(MOAO):
class NodeInputSlot(Named):
"""
Keyword arguments
-----------------
description : str
(default "")
scriptableValues : List[ScriptableValue]
identifier : str
name : str
(default None)
"""

def __init__(self , description="", **kwargs):
super().__init__(**kwargs)
self.description = description
self.scriptableValues = list()
self.identifier = None
self.name = None
for key, value in kwargs.items():
if not isinstance(value, Dict):
setattr(self, key, value)
Expand All @@ -32,7 +32,7 @@ def __init__(self , description="", **kwargs):
@property
def blueprint(self) -> Blueprint:
"""Return blueprint that this entity represents"""
return LinkableBlueprint()
return NodeInputSlotBlueprint()


@property
Expand All @@ -58,11 +58,11 @@ def scriptableValues(self, value: List[ScriptableValue]):
self.__scriptableValues = value

@property
def identifier(self) -> str:
def name(self) -> str:
""""""
return self.__identifier
return self.__name

@identifier.setter
def identifier(self, value: str):
"""Set identifier"""
self.__identifier = value
@name.setter
def name(self, value: str):
"""Set name"""
self.__name = value
Loading

0 comments on commit 886d065

Please sign in to comment.