Datasets:
Update README.md
Browse files
README.md
CHANGED
@@ -1918,28 +1918,60 @@ Mesh objects included in samples follow the [CGNS](https://cgns.github.io/) stan
|
|
1918 |
|
1919 |
Example of commands:
|
1920 |
```python
|
1921 |
-
|
1922 |
-
|
1923 |
-
|
1924 |
-
ids_split_0 = dataset.description["split"]['train']
|
1925 |
-
sample_0_split_0 = dataset[ids_split_0[0]]["sample"]
|
1926 |
-
plaid_sample = Sample.model_validate(pickle.loads(sample_0_split_0))
|
1927 |
-
print("type(plaid_sample) =", type(plaid_sample))
|
1928 |
|
1929 |
-
|
|
|
1930 |
|
1931 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1932 |
for fn in ["sdf", "ro", "rou", "rov", "roe", "nut", "mach"]:
|
1933 |
-
print(f"{fn} =",
|
1934 |
-
print("M_iso =",
|
1935 |
-
for sn in
|
1936 |
-
print(f"{sn} =",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1937 |
|
1938 |
-
|
1939 |
-
|
1940 |
-
|
1941 |
-
|
1942 |
-
print(
|
|
|
|
|
1943 |
```
|
1944 |
|
1945 |
## Dataset Details
|
|
|
1918 |
|
1919 |
Example of commands:
|
1920 |
```python
|
1921 |
+
from datasets import load_dataset
|
1922 |
+
from plaid.containers.sample import Sample
|
1923 |
+
import pickle
|
|
|
|
|
|
|
|
|
1924 |
|
1925 |
+
# Load the dataset
|
1926 |
+
hf_dataset = load_dataset("PLAID-datasets/VKI-LS59", split="all_samples")
|
1927 |
|
1928 |
+
# Get split ids
|
1929 |
+
ids_train = hf_dataset.description["split"]['train']
|
1930 |
+
ids_test = hf_dataset.description["split"]['test']
|
1931 |
+
|
1932 |
+
# Get inputs/outputs names
|
1933 |
+
in_scalars_names = hf_dataset.description["in_scalars_names"]
|
1934 |
+
out_fields_names = hf_dataset.description["out_fields_names"]
|
1935 |
+
|
1936 |
+
# Get samples
|
1937 |
+
sample = Sample.model_validate(pickle.loads(hf_dataset[ids_train[0]]["sample"]))
|
1938 |
+
sample = Sample.model_validate(pickle.loads(hf_dataset[ids_test[0]]["sample"]))
|
1939 |
+
|
1940 |
+
# Examples data retrievals
|
1941 |
for fn in ["sdf", "ro", "rou", "rov", "roe", "nut", "mach"]:
|
1942 |
+
print(f"{fn} =", sample.get_field(fn, base_name="Base_2_2"))
|
1943 |
+
print("M_iso =", sample.get_field("M_iso", base_name="Base_1_2"))
|
1944 |
+
for sn in sample.get_scalar_names():
|
1945 |
+
print(f"{sn} =", sample.get_scalar(sn))
|
1946 |
+
|
1947 |
+
print("nodes 2D (flow) =", sample.get_nodes(base_name="Base_2_2"))
|
1948 |
+
print("nodes 1D (blade surface) =", sample.get_nodes(base_name="Base_1_2"))
|
1949 |
+
print("elements 2D (flow) =", sample.get_elements(base_name="Base_2_2"))
|
1950 |
+
print("elements 1D (blade surface) =", sample.get_elements(base_name="Base_1_2"))
|
1951 |
+
print("nodal_tags 2D (flow) =", sample.get_nodal_tags(base_name="Base_2_2"))
|
1952 |
+
|
1953 |
+
# inputs
|
1954 |
+
nodes = sample.get_nodes(base_name="Base_2_2")
|
1955 |
+
elements = sample.get_elements(base_name="Base_2_2")
|
1956 |
+
nodal_tags = sample.get_nodal_tags(base_name="Base_2_2")
|
1957 |
+
sdf = sample.get_field("sdf", base_name="Base_2_2")
|
1958 |
+
angle_in = sample.get_scalar("angle_in")
|
1959 |
+
mach_out = sample.get_scalar("mach_out")
|
1960 |
+
|
1961 |
+
# outputs
|
1962 |
+
mach = sample.get_field("mach", base_name="Base_2_2")
|
1963 |
+
nut = sample.get_field("nut", base_name="Base_2_2")
|
1964 |
+
|
1965 |
+
for sn in ["Q", "power", "Pr", "Tr", "eth_is", "angle_out"]:
|
1966 |
+
outscalar = sample.get_scalar(sn)
|
1967 |
|
1968 |
+
# Get the mesh and convert it to Muscat
|
1969 |
+
from Muscat.Bridges import CGNSBridge
|
1970 |
+
CGNS_tree = sample.get_mesh()
|
1971 |
+
mesh_fluid = CGNSBridge.CGNSToMesh(CGNS_tree, baseNames=["Base_2_2"])
|
1972 |
+
print(mesh_fluid)
|
1973 |
+
mesh_blade = CGNSBridge.CGNSToMesh(CGNS_tree, baseNames=["Base_1_2"])
|
1974 |
+
print(mesh_blade)
|
1975 |
```
|
1976 |
|
1977 |
## Dataset Details
|