[claw-users] Reading GeoClaw output in Python

68 views
Skip to first unread message

Marc Kjerland

unread,
Oct 5, 2016, 3:19:54 AM10/5/16
to claw-...@googlegroups.com
Hi all,

Is there a simple option to read GeoClaw output into Python? The documentation contains many details about plotting in Python but it's less obvious how to read in values for analysis, even just at the top AMR level.

Cheers,
Marc

--
Marc Kjerland
Postdoctoral Researcher
DPRI, Kyoto University

Kyle Mandli

unread,
Oct 5, 2016, 9:57:21 AM10/5/16
to claw-...@googlegroups.com, Marc Kjerland
Hi Marc,

The visualization package uses modules from PyClaw to read in the solution and gauge data.  For instance

import clawpack.pyclaw.solution as solution
sol = solution.Solution(0, path="./_output", file_format='binary')

would read in frame 0 (the initial condition) from “_output” assuming the file was in the Fortran binary format (usually what we set the storm surge output to be).  You can then access the q data for instance via

sol.states[i].q

corresponding to the ith state (states and patches are mostly synonymous when dealing with GeoClaw output).  Information about the location and level of the particular patch (grid) you are on can be obtained by 

sol.domain.patches[i]

For the gauges there is something similar:

import clawpack.pyclaw.gauges as gauges
gauge = gauges.GaugeSolution(1, path="_output”)

where if you wanted to plot the data you could do

plt.plot(gauge.t, gauge.q[0, :])

for instance.

Kyle
--
You received this message because you are subscribed to the Google Groups "claw-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to claw-users+...@googlegroups.com.
To post to this group, send email to claw-...@googlegroups.com.
Visit this group at https://groups.google.com/group/claw-users.
For more options, visit https://groups.google.com/d/optout.

Marc Kjerland

unread,
Oct 5, 2016, 9:09:12 PM10/5/16
to claw-...@googlegroups.com
Hi Kyle,

Thanks, sol.domain.patches[i] was what I was missing.

Best,
Marc


--
Marc Kjerland
Postdoctoral Researcher
DPRI, Kyoto University

To unsubscribe from this group and stop receiving emails from it, send an email to claw-users+unsubscribe@googlegroups.com.

To post to this group, send email to claw-...@googlegroups.com.
Visit this group at https://groups.google.com/group/claw-users.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "claw-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to claw-users+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages