Giter Site home page Giter Site logo

modvis's People

Contributors

pinshuai avatar zexuanxu avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

modvis's Issues

xmdf.VisFile with columnar True

Environment Information

  • modvis version: 0.0.1
  • Python version: python3.10
  • Operating System: Mac

Description

I want to load the .h5 file from ats output and visualize them in Jupyter Notebook.

What I Did

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.

visfile.times

Environment Information

modvis version: 0.0.1
Python version: python3.10
Operating System: Mac

Description

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.

What I Did

Paste the command(s) you ran and the output.
If there was a crash, please include the traceback here.

Hi modvis team,

I want to visualize a cold spin up which has around 20000 days using pv.plot_surface_data. However, it said that

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.