Datasets:
Update README.md
Browse files
README.md
CHANGED
@@ -2273,32 +2273,46 @@ Mesh objects included in samples follow the [CGNS](https://cgns.github.io/) stan
|
|
2273 |
|
2274 |
Example of commands:
|
2275 |
```python
|
2276 |
-
import pickle
|
2277 |
from datasets import load_dataset
|
2278 |
from plaid.containers.sample import Sample
|
|
|
2279 |
|
2280 |
# Load the dataset
|
2281 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2282 |
|
2283 |
-
|
2284 |
-
|
2285 |
-
ids_split_0 = dataset.description["split"][split_names[0]]
|
2286 |
-
sample_0_split_0 = dataset[ids_split_0[0]]["sample"]
|
2287 |
-
plaid_sample = Sample.model_validate(pickle.loads(sample_0_split_0))
|
2288 |
-
print("type(plaid_sample) =", type(plaid_sample))
|
2289 |
|
2290 |
-
|
|
|
2291 |
|
2292 |
-
#
|
2293 |
-
|
2294 |
-
field =
|
2295 |
-
print("field_names[0] =", field_names[0])
|
2296 |
|
2297 |
-
|
|
|
2298 |
|
2299 |
# Get the mesh and convert it to Muscat
|
2300 |
from Muscat.Bridges import CGNSBridge
|
2301 |
-
CGNS_tree =
|
2302 |
mesh = CGNSBridge.CGNSToMesh(CGNS_tree)
|
2303 |
print(mesh)
|
2304 |
```
|
|
|
2273 |
|
2274 |
Example of commands:
|
2275 |
```python
|
|
|
2276 |
from datasets import load_dataset
|
2277 |
from plaid.containers.sample import Sample
|
2278 |
+
import pickle
|
2279 |
|
2280 |
# Load the dataset
|
2281 |
+
hf_dataset = load_dataset("PLAID-datasets/Rotor37", split="all_samples")
|
2282 |
+
|
2283 |
+
# Get split ids
|
2284 |
+
ids_train = hf_dataset.description["split"]['train_1000']
|
2285 |
+
ids_test = hf_dataset.description["split"]['test']
|
2286 |
+
|
2287 |
+
# Get inputs/outputs names
|
2288 |
+
in_scalars_names = hf_dataset.description["in_scalars_names"]
|
2289 |
+
out_fields_names = hf_dataset.description["out_fields_names"]
|
2290 |
+
|
2291 |
+
# Get samples
|
2292 |
+
sample = Sample.model_validate(pickle.loads(hf_dataset[ids_train[0]]["sample"]))
|
2293 |
+
sample_2 = Sample.model_validate(pickle.loads(hf_dataset[ids_test[0]]["sample"]))
|
2294 |
+
|
2295 |
+
# Examples data retrievals
|
2296 |
+
# inputs
|
2297 |
+
nodes = sample.get_nodes()
|
2298 |
+
elements = sample.get_elements()
|
2299 |
|
2300 |
+
for fn in ['NormalsX', 'NormalsY', 'NormalsZ']:
|
2301 |
+
field = sample.get_field(fn)
|
|
|
|
|
|
|
|
|
2302 |
|
2303 |
+
for sn in ['Omega', 'P']:
|
2304 |
+
scalar = sample.get_scalar(sn)
|
2305 |
|
2306 |
+
# outputs
|
2307 |
+
for fn in ['Density', 'Pressure', 'Temperature']:
|
2308 |
+
field = sample.get_field(fn)
|
|
|
2309 |
|
2310 |
+
for sn in ['Massflow', 'Compression_ratio', 'Efficiency']:
|
2311 |
+
scalar = sample.get_scalar(sn)
|
2312 |
|
2313 |
# Get the mesh and convert it to Muscat
|
2314 |
from Muscat.Bridges import CGNSBridge
|
2315 |
+
CGNS_tree = sample.get_mesh()
|
2316 |
mesh = CGNSBridge.CGNSToMesh(CGNS_tree)
|
2317 |
print(mesh)
|
2318 |
```
|