pinshuai / modvis Goto Github PK
View Code? Open in Web Editor NEWA python package for model visualization
Home Page: https://pinshuai.github.io/modvis
License: MIT License
A python package for model visualization
Home Page: https://pinshuai.github.io/modvis
License: MIT License
I want to load the .h5 file from ats output and visualize them in Jupyter Notebook.
import numpy as np
import modvis.ats_xdmf as xdmf
import modvis.plot_vis_file as pv
model_dir = "/"
visfile = xdmf.VisFile(model_dir, domain=None, load_mesh=True, columnar=True)
Only these lines but after I run it gave many array of warnings and really slow:
2023-07-25 15:47:47,273 - root - WARNING: cycle 0 not found in HDF5 file! Return Nans.
2023-07-25 15:47:47,662 - root - WARNING: cycle 0 not found in HDF5 file! Return Nans.
2023-07-25 15:47:48,054 - root - WARNING: cycle 0 not found in HDF5 file! Return Nans.
2023-07-25 15:47:48,443 - root - WARNING: cycle 0 not found in HDF5 file! Return Nans.
2023-07-25 15:47:48,827 - root - WARNING: cycle 0 not found in HDF5 file! Return Nans.
2023-07-25 15:47:49,229 - root - WARNING: cycle 0 not found in HDF5 file! Return Nans.
2023-07-25 15:47:49,624 - root - WARNING: cycle 0 not found in HDF5 file! Return Nans.
2023-07-25 15:47:50,011 - root - WARNING: cycle 0 not found in HDF5 file! Return Nans.
2023-07-25 15:47:50,394 - root - WARNING: cycle 0 not found in HDF5 file! Return Nans.
2023-07-25 15:47:50,778 - root - WARNING: cycle 0 not found in HDF5 file! Return Nans.
2023-07-25 15:47:51,171 - root - WARNING: cycle 0 not found in HDF5 file! Return Nans.
2023-07-25 15:47:51,549 - root - WARNING: cycle 0 not found in HDF5 file! Return Nans.
2023-07-25 15:47:51,938 - root - WARNING: cycle 0 not found in HDF5 file! Return Nans.
2023-07-25 15:47:52,326 - root - WARNING: cycle 0 not found in HDF5 file! Return Nans.
2023-07-25 15:47:52,713 - root - WARNING: cycle 0 not found in HDF5 file! Return Nans.
2023-07-25 15:47:53,099 - root - WARNING: cycle 0 not found in HDF5 file! Return Nans.
2023-07-25 15:47:53,486 - root - WARNING: cycle 0 not found in HDF5 file! Return Nans.
2023-07-25 15:47:53,875 - root - WARNING: cycle 0 not found in HDF5 file! Return Nans.
2023-07-25 15:47:54,266 - root - WARNING: cycle 0 not found in HDF5 file! Return Nans.
2023-07-25 15:47:54,653 - root - WARNING: cycle 0 not found in HDF5 file! Return Nans.
2023-07-25 15:47:55,044 - root - WARNING: cycle 0 not found in HDF5 file! Return Nans.
2023-07-25 15:47:55,439 - root - WARNING: cycle 0 not found in HDF5 file! Return Nans.
2023-07-25 15:47:55,825 - root - WARNING: cycle 0 not found in HDF5 file! Return Nans.
2023-07-25 15:47:56,210 - root - WARNING: cycle 0 not found in HDF5 file! Return Nans.
2023-07-25 15:47:56,597 - root - WARNING: cycle 0 not found in HDF5 file! Return Nans.
2023-07-25 15:47:56,988 - root - WARNING: cycle 0 not found in HDF5 file! Return Nans.
2023-07-25 15:47:57,385 - root - WARNING: cycle 0 not found in HDF5 file! Return Nans.
2023-07-25 15:47:57,789 - root - WARNING: cycle 0 not found in HDF5 file! Return Nans.
2023-07-25 15:47:58,190 - root - WARNING: cycle 0 not found in HDF5 file! Return Nans.
2023-07-25 15:47:58,580 - root - WARNING: cycle 0 not found in HDF5 file! Return Nans.
2023-07-25 15:47:58,977 - root - WARNING: cycle 0 not found in HDF5 file! Return Nans.
2023-07-25 15:47:59,374 - root - WARNING: cycle 0 not found in HDF5 file! Return Nans.
2023-07-25 15:47:59,759 - root - WARNING: cycle 0 not found in HDF5 file! Return Nans.
2023-07-25 15:48:00,163 - root - WARNING: cycle 0 not found in HDF5 file! Return Nans.
2023-07-25 15:48:00,561 - root - WARNING: cycle 0 not found in HDF5 file! Return Nans.
2023-07-25 15:48:00,965 - root - WARNING: cycle 0 not found in HDF5 file! Return Nans.
2023-07-25 15:48:01,364 - root - WARNING: cycle 0 not found in HDF5 file! Return Nans.
2023-07-25 15:48:01,752 - root - WARNING: cycle 0 not found in HDF5 file! Return Nans.
2023-07-25 15:48:02,134 - root - WARNING: cycle 0 not found in HDF5 file! Return Nans.
2023-07-25 15:48:02,520 - root - WARNING: cycle 0 not found in HDF5 file! Return Nans.
2023-07-25 15:48:02,904 - root - WARNING: cycle 0 not found in HDF5 file! Return Nans.
2023-07-25 15:48:03,298 - root - WARNING: cycle 0 not found in HDF5 file! Return Nans.
2023-07-25 15:48:03,701 - root - WARNING: cycle 0 not found in HDF5 file! Return Nans.
2023-07-25 15:48:04,097 - root - WARNING: cycle 0 not found in HDF5 file! Return Nans.
2023-07-25 15:48:04,492 - root - WARNING: cycle 0 not found in HDF5 file! Return Nans.
2023-07-25 15:48:04,880 - root - WARNING: cycle 0 not found in HDF5 file! Return Nans.
2023-07-25 15:48:05,266 - root - WARNING: cycle 0 not found in HDF5 file! Return Nans.
2023-07-25 15:48:05,657 - root - WARNING: cycle 0 not found in HDF5 file! Return Nans.
2023-07-25 15:48:06,043 - root - WARNING: cycle 0 not found in HDF5 file! Return Nans.
2023-07-25 15:48:06,433 - root - WARNING: cycle 0 not found in HDF5 file! Return Nans.
2023-07-25 15:48:06,826 - root - WARNING: cycle 0 not found in HDF5 file! Return Nans.
2023-07-25 15:48:07,217 - root - WARNING: cycle 0 not found in HDF5 file! Return Nans.
2023-07-25 15:48:07,606 - root - WARNING: cycle 0 not found in HDF5 file! Return Nans.
2023-07-25 15:48:08,001 - root - WARNING: cycle 0 not found in HDF5 file! Return Nans.
2023-07-25 15:48:08,389 - root - WARNING: cycle 0 not found in HDF5 file! Return Nans.
2023-07-25 15:48:08,777 - root - WARNING: cycle 0 not found in HDF5 file! Return Nans.
2023-07-25 15:48:09,162 - root - WARNING: cycle 0 not found in HDF5 file! Return Nans.
2023-07-25 15:48:09,577 - root - WARNING: cycle 0 not found in HDF5 file! Return Nans.
2023-07-25 15:48:09,980 - root - WARNING: cycle 0 not found in HDF5 file! Return Nans.
...
Paste the command(s) you ran and the output.
If there was a crash, please include the traceback here.
modvis version: 0.0.1
Python version: python3.10
Operating System: Mac
Describe what you were trying to get done.
Tell us what happened, what went wrong, and what you expected to happen.
Do visualization for a long cold spinup.
Paste the command(s) you ran and the output.
If there was a crash, please include the traceback here.
Hi modvis team,
ValueError Traceback (most recent call last)
Input In [27], in <cell line: 1>()
----> 1 fig, ax, tpc = pv.plot_surface_data(visfile, var_name="surface-ponded_depth",
2 log = True, vmin=0.0001, vmax=0.1,
3 time_slice=1, origin_date="0001-01-01")
File ~/anaconda3/envs/watershed_workflow-2022-08-29/lib/python3.10/site-packages/modvis/plot_vis_file.py:511, in plot_surface_data(vis_data, var_name, origin_date, time_slice, facecolors, subset, subset_idx, colorbar, clabel, title, ax, log, vmin, vmax, robust, contour, nlevel, linthresh, linscale, data_lim, **kwargs)
508 conn = vis_data.conn
509 volume = vis_data.volume
--> 511 times, time_idx = get_time(vis_data, time_slice, origin_date=origin_date)
513 if isinstance(var_name, str):
514 dat = vis_data.getArray(var_name)
File ~/anaconda3/envs/watershed_workflow-2022-08-29/lib/python3.10/site-packages/modvis/plot_vis_file.py:53, in get_time(vis_data, time_slice, **kwargs)
51 """get time index if time_slice is str formatted"""
52 times = vis_data.times
---> 53 times = rmLeapDays(times, **kwargs)
55 if time_slice is not None:
56 try:
File ~/anaconda3/envs/watershed_workflow-2022-08-29/lib/python3.10/site-packages/modvis/ATSutils.py:398, in rmLeapDays(time_ats, origin_date, noleap, freq)
396 else:
397 raise RuntimeError("Must be either D or H freq!")
--> 398 model_start_date = origin_date.replace(year = origin_date.year + int(model_start_year))
399 model_start_date = model_start_date + timedelta(days = int(model_start_doy))
401 if freq == 'D':
ValueError: year 20184 is out of range.
So apparently the visfile.times are very large in my case: [7001842.5, 7012800. , 7023757.5, 7034715. , 7045672.5, 7056630. ,
7067587.5, 7078545. , ]
But when I visualize water_balance.dat without using modvis, the time is around 20000 days without a problem. I am wondering what the visfile.times actually return, and how I might adjust the time to visualize my 3D mesh. Thank you!
Best,
Lijing.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.