Comments (6)
We are considering ways to improve consistency with xarray, currently experimenting with a dfs engine for dfs{2,3].
It could be as simple as:
import xarray as xr
import mikeio
ds = xr.open_dataset("some_meteo.dfs2", engine="mikeio")
That would be great for structured data, but I am still searching for the optimal solution for unstructured meshes, let me know if you have any suggestion.
from mikeio.
You likely know that this topic is also realized by xarray: https://docs.xarray.dev/en/stable/roadmap.html#specific-needs
Maybe also worth to look at xarray extension approach by Deltares: https://github.com/Deltares/xugrid
In general, I find your geometry
approach in mikeio
much tidier than having additional dimensions like x_nodes
etc. to store the mesh in the same ds. But keeping it seperate will require to also modify the geometry for all the .sel
and aggregation methods. So, unfortunately no, no really good ideas right now from my end. But I am happy to test and contribute once your experiments mature :-)
from mikeio.
@Hendrik1987 how did you select in time?
I get no time dimension.
>>> ds = mikeio.read("waves.dfs2")
>>> ds
<mikeio.Dataset>
dims: (time:3, y:31, x:31)
time: 2004-01-01 00:00:00 - 2004-01-03 00:00:00 (3 records)
geometry: Grid2D (ny=31, nx=31)
items:
0: Sign. Wave Height <Significant wave height> (meter)
1: Peak Wave Period <Wave period> (second)
2: Mean Wave Direction <Mean Wave Direction> (degree)
>>> ds.isel(time=0)
<mikeio.Dataset>
dims: (y:31, x:31)
time: 2004-01-01 00:00:00 (time-invariant)
geometry: Grid2D (ny=31, nx=31)
items:
0: Sign. Wave Height <Significant wave height> (meter)
1: Peak Wave Period <Wave period> (second)
2: Mean Wave Direction <Mean Wave Direction> (degree)
>>> ds = mikeio.read("waves.dfs2",time=0)
>>> ds
<mikeio.Dataset>
dims: (y:31, x:31)
time: 2004-01-01 00:00:00 (time-invariant)
geometry: Grid2D (ny=31, nx=31)
items:
0: Sign. Wave Height <Significant wave height> (meter)
1: Peak Wave Period <Wave period> (second)
2: _Mean_ Wave Direction <Mean Wave Direction> (degree)
ds.sel(time="2004-01-01")
<mikeio.Dataset>
dims: (y:31, x:31)
time: 2004-01-01 00:00:00 (time-invariant)
geometry: Grid2D (ny=31, nx=31)
items:
0: Sign. Wave Height <Significant wave height> (meter)
1: Peak Wave Period <Wave period> (second)
2: Mean Wave Direction <Mean Wave Direction> (degree)
>>>
from mikeio.
Sorry for the incomplete / incorrect report @ecomodeller
It actually does not happen during time select or aggregation, but when reading a time-invariant dfsu:
from mikeio.
Sorry for the incomplete / incorrect report @ecomodeller It actually does not happen during time select or aggregation, but when reading a time-invariant dfsu:
That is by design. If you know you are expect a time-invariant dfs file, you can do mikeio.read("time-invariant.dfsu", time=0)
.
In a NetCdf file you can be explicit about the dimensions, e.g. time can be a dimension with a single timestep, or have no time dimension, but in a dfs file, there will always be a start_time even if we want to interpret the file as time invariant.
It is a not easy to come up with a good design for singleton dimensions, but I hope this is good enough.
from mikeio.
Your suggestion mikeio.read("time-invariant.dfsu", time=0)
works.
Both, ds
and ds2
above carry the information on the first time step, or not? Only the array shape is different.
I personaly would expect a behaviour where after write and read ds2
is the same as ds
. But the current design is definetely good enough!
from mikeio.
Related Issues (20)
- Dfsu3D - vertical max, mean, and min
- Writing a Dfs2 file from python does not retain the x and y coordinates HOT 6
- matplotlib should be optional HOT 1
- Extracting data from a large .dfs2 file HOT 4
- When trying to append multiple non-equidistant DFS0 following error message pops up HOT 2
- Appending data to a DataArray in Dfs2 file HOT 2
- Replace legacy interp1d with np.interp
- Dfs2 - static items (bathymetry) HOT 6
- Pass kwargs to plot.mesh HOT 2
- Error in executing code for building documentation not reported as a failing step in Action
- Drop support for 3.8
- Point incorrectly considered outside domain HOT 2
- Page not found at https://dhi.github.io/mikeio/dfs1.html HOT 2
- pip install error HOT 4
- Dfsu read elements reordered
- extract_track bug HOT 8
- Error in DataArray.__init__ if data is the last column of a dataframe HOT 5
- DFSU.read() very slow on AMD CPU or linux
- Concat bug with mikeio>2.0 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mikeio.