Skip to content

Commit

Permalink
chore: Merge branch 'main' into multi-model
Browse files Browse the repository at this point in the history
  • Loading branch information
jetuk committed Oct 23, 2023
2 parents 16104e6 + 25e32b4 commit f8cd45a
Show file tree
Hide file tree
Showing 20 changed files with 355 additions and 473 deletions.
202 changes: 0 additions & 202 deletions LICENSE

This file was deleted.

7 changes: 7 additions & 0 deletions pywr-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
name = "pywr-cli"
version = "0.1.0"
edition = "2021"
rust-version = "1.60"
description = "A generalised water resource allocation model."
readme = "../README.md"
repository = "https://github.com/pywr/pywr-next/"
license = "MIT OR Apache-2.0"
keywords = ["water", "modelling"]
categories = ["science", "simulation"]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand Down
3 changes: 1 addition & 2 deletions pywr-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ authors = ["James Tomlinson <[email protected]>"]
edition = "2021"
rust-version = "1.60"
description = "A generalised water resource allocation model."
readme = "README.md"
readme = "../README.md"
repository = "https://github.com/pywr/pywr-next/"
license = "MIT OR Apache-2.0"
license-file = "LICENSE"
keywords = ["water", "modelling"]
categories = ["science", "simulation"]

Expand Down
8 changes: 8 additions & 0 deletions pywr-python/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
name = "pywr-python"
version = "0.1.0"
edition = "2021"
rust-version = "1.60"
description = "A generalised water resource allocation model."
readme = "../README.md"
repository = "https://github.com/pywr/pywr-next/"
license = "MIT OR Apache-2.0"
keywords = ["water", "modelling", "python"]
categories = ["science", "simulation"]


# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand Down
5 changes: 3 additions & 2 deletions pywr-schema/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ authors = ["James Tomlinson <[email protected]>"]
edition = "2021"
rust-version = "1.60"
description = "A generalised water resource allocation model."
readme = "README.md"
readme = "../README.md"
repository = "https://github.com/pywr/pywr-next/"
license = "MIT OR Apache-2.0"
license-file = "LICENSE"
keywords = ["water", "modelling"]
categories = ["science", "simulation"]

Expand All @@ -18,6 +17,8 @@ categories = ["science", "simulation"]
svgbobdoc = { version = "0.3.0", features = ["enable"] }
polars = { version = "0.33.2", features = ["lazy", "rows", "ndarray"] }
pyo3-polars = "0.7.0"
strum = "0.25"
strum_macros = "0.25"

hdf5 = { workspace = true }
csv = { workspace = true }
Expand Down
4 changes: 3 additions & 1 deletion pywr-schema/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ pub enum ConversionError {
UnexpectedAttribute { attrs: Vec<String>, name: String },
#[error("Can not convert a float constant to an index constant.")]
FloatToIndex,
#[error("Attribute {attr:?} is not allowed on node {name:?}.")]
#[error("Attribute {attr:?} on node {name:?} is not allowed .")]
ExtraNodeAttribute { attr: String, name: String },
#[error("Custom node of type {ty:?} on node {name:?} is not supported .")]
CustomNodeNotSupported { ty: String, name: String },
}
12 changes: 11 additions & 1 deletion pywr-schema/src/nodes/annual_virtual_storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,17 @@ pub struct AnnualReset {
pub use_initial_volume: bool,
}

#[derive(serde::Deserialize, serde::Serialize, Clone)]
impl Default for AnnualReset {
fn default() -> Self {
Self {
day: 1,
month: time::Month::January,
use_initial_volume: false,
}
}
}

#[derive(serde::Deserialize, serde::Serialize, Clone, Default)]
pub struct AnnualVirtualStorageNode {
#[serde(flatten)]
pub meta: NodeMeta,
Expand Down
14 changes: 7 additions & 7 deletions pywr-schema/src/nodes/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use pywr_v1_schema::nodes::{
use std::collections::HashMap;
use std::path::Path;

#[derive(serde::Deserialize, serde::Serialize, Clone)]
#[derive(serde::Deserialize, serde::Serialize, Clone, Default)]
pub struct InputNode {
#[serde(flatten)]
pub meta: NodeMeta,
Expand Down Expand Up @@ -112,7 +112,7 @@ impl TryFrom<InputNodeV1> for InputNode {
}
}

#[derive(serde::Deserialize, serde::Serialize, Clone)]
#[derive(serde::Deserialize, serde::Serialize, Clone, Default)]
pub struct LinkNode {
#[serde(flatten)]
pub meta: NodeMeta,
Expand Down Expand Up @@ -210,7 +210,7 @@ impl TryFrom<LinkNodeV1> for LinkNode {
}
}

#[derive(serde::Deserialize, serde::Serialize, Clone)]
#[derive(serde::Deserialize, serde::Serialize, Clone, Default)]
pub struct OutputNode {
#[serde(flatten)]
pub meta: NodeMeta,
Expand Down Expand Up @@ -309,7 +309,7 @@ impl TryFrom<OutputNodeV1> for OutputNode {
}
}

#[derive(serde::Deserialize, serde::Serialize, Clone)]
#[derive(serde::Deserialize, serde::Serialize, Clone, Default)]
pub struct StorageNode {
#[serde(flatten)]
pub meta: NodeMeta,
Expand Down Expand Up @@ -489,7 +489,7 @@ impl TryFrom<ReservoirNodeV1> for StorageNode {
/// ```
///
)]
#[derive(serde::Deserialize, serde::Serialize, Clone)]
#[derive(serde::Deserialize, serde::Serialize, Clone, Default)]
pub struct CatchmentNode {
#[serde(flatten)]
pub meta: NodeMeta,
Expand Down Expand Up @@ -566,7 +566,7 @@ pub enum Factors {
Ratio { factors: Vec<DynamicFloatValue> },
}

#[derive(serde::Deserialize, serde::Serialize, Clone)]
#[derive(serde::Deserialize, serde::Serialize, Clone, Default)]
pub struct AggregatedNode {
#[serde(flatten)]
pub meta: NodeMeta,
Expand Down Expand Up @@ -684,7 +684,7 @@ impl TryFrom<AggregatedNodeV1> for AggregatedNode {
}
}

#[derive(serde::Deserialize, serde::Serialize, Clone)]
#[derive(serde::Deserialize, serde::Serialize, Clone, Default)]
pub struct AggregatedStorageNode {
#[serde(flatten)]
pub meta: NodeMeta,
Expand Down
2 changes: 1 addition & 1 deletion pywr-schema/src/nodes/delay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use pywr_v1_schema::nodes::DelayNode as DelayNodeV1;
/// ```
///
)]
#[derive(serde::Deserialize, serde::Serialize, Clone)]
#[derive(serde::Deserialize, serde::Serialize, Clone, Default)]
pub struct DelayNode {
#[serde(flatten)]
pub meta: NodeMeta,
Expand Down
2 changes: 1 addition & 1 deletion pywr-schema/src/nodes/loss_link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use std::path::Path;
/// ```
///
)]
#[derive(serde::Deserialize, serde::Serialize, Clone)]
#[derive(serde::Deserialize, serde::Serialize, Clone, Default)]
pub struct LossLinkNode {
#[serde(flatten)]
pub meta: NodeMeta,
Expand Down
Loading

0 comments on commit f8cd45a

Please sign in to comment.