pax_global_header00006660000000000000000000000064143610570650014521gustar00rootroot0000000000000052 comment=9128459489a0a9423e0942827a41d29556551c42 h5utils-1.13.2/000077500000000000000000000000001436105706500132025ustar00rootroot00000000000000h5utils-1.13.2/.gitignore000066400000000000000000000007571436105706500152030ustar00rootroot00000000000000*.tar.gz *.exe *.dll *.do *.o *.lo *.a *.la *.dylib *.dSYM *.zip *.native _build # autotools stuff Makefile Makefile.in .deps .libs stamp-h* install-sh libtool ltmain.sh m4/libtool.m4 m4/ltoptions.m4 m4/ltsugar.m4 m4/ltversion.m4 m4/lt~obsolete.m4 configure config.* autom4te.cache INSTALL aclocal.m4 depcomp missing py-compile compile test-driver # programs h5totxt h5fromtxt h5topng h5tov5d h5tovtk h5math h5read.oct h4fromh5 h5fromh4 h5cyl2cart h5fromitxt # other generated files h5topng.1h5utils-1.13.2/AUTHORS000066400000000000000000000001011436105706500142420ustar00rootroot00000000000000h5utils was written by Steven G. Johnson (stevenj@alum.mit.edu). h5utils-1.13.2/COPYING000066400000000000000000000465031436105706500142450ustar00rootroot00000000000000############################################################################# The h5utils package is Copyright (c) 1999-2023 by the Massachusetts Institute of Technology ############################################################################# The following license applies to all files in the h5utils package, EXCEPT h5tov5d.c (see below). ############################################################################# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ############################################################################# The following license applies ONLY to h5tov5d.c. ############################################################################# GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19yy name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. h5utils-1.13.2/ChangeLog000066400000000000000000000001211436105706500147460ustar00rootroot00000000000000See https://github.com/NanoComp/h5utils for the complete git history of h5utils. h5utils-1.13.2/Makefile.am000066400000000000000000000034711436105706500152430ustar00rootroot00000000000000COLORMAPS = colormaps/autumn colormaps/bluered colormaps/bone \ colormaps/colorcube colormaps/cool colormaps/copper colormaps/flag \ colormaps/gray colormaps/green colormaps/hot colormaps/hsv \ colormaps/jet colormaps/lines colormaps/pink colormaps/prism \ colormaps/spring colormaps/summer colormaps/vga colormaps/winter \ colormaps/yarg colormaps/yellow colormaps/dkbluered \ colormaps/viridis colormaps/inferno colormaps/RdBu colormaps/BrBG EXTRA_MANS = doc/man/h5topng.1.in doc/man/h5tov5d.1 doc/man/h5fromh4.1 doc/man/h5math.1 EXTRA_DIST = h5read.cc copyright.h $(COLORMAPS) $(EXTRA_MANS) noinst_PROGRAMS = h5cyl2cart # not documented/supported yet bin_PROGRAMS = h5totxt h5fromtxt h5tovtk @MORE_H5UTILS@ EXTRA_PROGRAMS = h5topng h5tov5d h5fromh4 h4fromh5 h5math dist_man_MANS = doc/man/h5totxt.1 doc/man/h5fromtxt.1 doc/man/h5tovtk.1 @MORE_H5UTILS_MANS@ nodist_man_MANS = @H5TOPNG_MAN@ COMMON_SRC = arrayh5.c arrayh5.h h5utils.c h5utils.h h5totxt_SOURCES = h5totxt.c $(COMMON_SRC) h5fromtxt_SOURCES = h5fromtxt.c $(COMMON_SRC) h5tovtk_SOURCES = h5tovtk.c $(COMMON_SRC) h5topng_SOURCES = h5topng.c writepng.c writepng.h $(COMMON_SRC) h5topng_LDADD = @PNG_LIBS@ h5tov5d_SOURCES = h5tov5d.c $(COMMON_SRC) h5tov5d_CPPFLAGS = $(AM_CPPFLAGS) @V5D_INCLUDES@ h5tov5d_LDADD = @V5D_FILES@ h5fromh4_SOURCES = h5fromh4.c arrayh4.c arrayh4.h $(COMMON_SRC) h5fromh4_LDADD = @H4_LIBS@ h4fromh5_SOURCES = h4fromh5.c arrayh4.c arrayh4.h $(COMMON_SRC) h4fromh5_LDADD = @H4_LIBS@ h5math_SOURCES = h5math.c $(COMMON_SRC) h5math_LDADD = -lmatheval h5cyl2cart_SOURCES = h5cyl2cart.c $(COMMON_SRC) octdir = @OCT_INSTALL_DIR@ oct_DATA = @H5READ@ h5read.oct: h5read.cc arrayh5.h arrayh5.o mkoctfile $(DEFS) $(CPPFLAGS) $(srcdir)/h5read.cc $(srcdir)/arrayh5.c $(LDFLAGS) $(LIBS) clean-local: rm -f h5read.oct nobase_dist_pkgdata_DATA = $(COLORMAPS) h5utils-1.13.2/NEWS.md000066400000000000000000000160071436105706500143040ustar00rootroot00000000000000# Harminv Release Notes Here, we describe what has changed between releases of the [h5utils](README.md) package. ## h5utils-1.13.2 ## *1/15/23* * Support relocatable installations by expanding shell metacharacters `~` and environment variables in the colormaps directory (#16). ## h5utils-1.13.1 ## *3/19/18* * Fixed man page problems (#2 and #3), thanks to Bas Couwenberg. ## h5utils-1.13 ## *7/18/17* * Fixed `h5topng` compilation for modern libpng versions. Thanks to Daisuke Fujimura (@fd00 on github) for posting patches. * Moved hosting to Github and translated documentation to Markdown. ## h5utils 1.12.1 ## *6/24/09* * Use `octave-config`, if available, to detect octave-plugin installation path (thanks to Debian bug report #516453 for suggestion). ## h5utils 1.12 ## *6/12/09* * The vertical axis in `h5topng` is now reversed to correspond to what most people seem to expect: increasing coordinates correspond to "up" and "right" in the image, rather than "down" and "right" in the image as in previous versions. * Fixed failure in `h5tovtk -2`; thanks to Karen Lee for the bug report. * Fixed installation of `h5read.oct` for Octave 3.x. ## h5utils 1.11.1 ## *4/28/08* * Fixed failure to find colormap files in h5topng 1.11 (due to changes in autoconf 2.60); thanks to bug report from Jiangjun Zheng. ## h5utils 1.11 ## *4/24/08* * h5tovtk no longer reverses the dimensions; thanks to Andreas Wilde for the suggestion. * Fix compilation failure with HDF5 1.8. ## h5utils 1.10.1 ## *9/20/06* * Fixed build problem on Cygwin due to missing "`.exe`" extension. Thanks to Ken Hill for the bug report. ## h5utils 1.10 ## *9/2/05* * Added `h4fromh5` utility. (NCSA seems to be no longer shipping the HDF5/HDF4 conversion tools with the latest HDF5 release.) * Added `dkbluered` color map, which is similar to `bluered` but uses a somewhat wider range of colors. ## h5utils 1.9.1 ## *8/5/04* * Fix `h5topng` compilation failure with some non-C99 compilers; thanks to Maarten van Reeuwijk for the bug report. ## h5utils 1.9 ## *7/12/04* * Added new `h5math` utility, which creates and combines HDF5 datasets using a user-specified mathematical expression. (Requires [GNU libmatheval](http://www.gnu.org/software/libmatheval/) to be installed.) * `h5topng`: Matlab-like `start:end` or `start:step:end` notation for slice indices, to allow a whole sequence of slices to be output as a sequence of PNG images. * `h5topng`: if contour/overlay dataset does not have same dimensions as output data, it is periodically "tiled" over the output. ## h5utils 1.8 ## *5/22/04* * New `-A` and `-a` options for `h5topng` to allow translucent overlays from one file onto another (an alternative or complement to the `-C` contour-overlay option). * `h5topng` uses 24-bit direct color by default (use `-8` option for old 8-bit behavior). * `h5topng` uses columns/rows for x/y by default (use `-T` to swap), the opposite of the old behavior. * There is no default `-z 0` slice dimension in `h5topng`/`h5totxt` any more. You must specify a slice for 3+ dimensional data in `h5topng`. `h5totxt` dumps the whole data file by default unless one or more slices are specified. * Support specifying multiple slice dimensions for 4+ dimensional datasets, with new `-t` option to indicate final dimension. * Slices are also supported now in `h5tovtk` and `h5tov5d`. * New `-.` option in `h5totxt` to specify number of significant digits; output 16 digits by default instead of 6, previously. ## h5utils 1.7.2 ## *7/15/02* * Fixed C++ compilation problem for `g++` 3.x in `h5read` Octave plugin; thanks to Josselin Mouette for the patch. ## h5utils 1.7.1 ## *3/16/02* * Fixed array overrun in `h5topng` that caused a floating-point exception on Alphas; thanks to Marin Soljacic for the bug report. ## h5utils 1.7 ## *3/9/02* * `h5topng` now supports multiple, user-definable color tables, a number of which are provided. '''Incompatible change''': the `-c` option now has the syntax: `-c ''colortable''`. The old behavior corresponds to the included "`bluered`" colortable, invoked via: `-c bluered`. * New `-R` option for `h5topng` to use a consistent color scale for all specified files. * New `-0` option for `h5topng` and `h5totxt` that shifts the origin of the slice coordinates to the dataset center. * Added `h5tovtk` program to output VTK (Visualization ToolKit) data files. * Support `-T` (transpose dimensions) option in `h5tov5d`. * Fixed bug in `h5topng` that caused extra rows/columns of garbage pixels to be written at the edges of images when scaling was used. * When compiling the h5read Octave plugin, respect the `CPPFLAGS` and `LDFLAGS` environment variables. Thanks to Max Colice for the bug report. * Fixed problem when `--without-h5tov5d` and `--without-h5fromh4` are used. Thanks to Nikola Ivanov Nikolov for the fix. ## h5utils 1.6 ## *1/17/01* * Don't build `h5fromh4` if the superior `h4toh5` tool (from HDF5 1.4) is present. Also added `--{with,without}-h5fromh4` option to configure to force whether `h5fromh4` is built. ## h5utils 1.5.1 ## *12/9/00* * Support manually disabling Octave plugin support (`configure --without-octave`) in case of C++ problems. * Support Vis5d+ and Debian HDF header file locations. ## h5utils 1.5 ## *7/9/00* * Added `h5fromh4` program to convert HDF4 datasets to HDF5 format. * Added `-S ''s''` option to `h5topng` as a shortcut for `-X ''s'' -Y ''s''`. ## h5utils 1.4 ## *5/28/00* * Added `h5fromtxt` program to convert text input to an HDF5 dataset. ## h5utils 1.3.4 ## *1/31/00* * Improved -C contour plotting in h5topng. * Fix in `h5topng` man page (thanks to Christoph Becher). ## h5utils 1.3.3 ## *1/30/00* * Bug fix in `h5topng` (would sometimes output solid black images). Thanks to Karl Koch for the bug report. ## h5utils 1.3.2 ## *1/28/00* * Added `h5topng -Z` option to center color scale on zero. * Now support `h5topng -C ''filename:dataset''`. ## h5utils 1.3.1 ## *1/27/00* * Bug fixes in dataset name-handling, especially when using `h5tov5d` to join multiple datasets into one output file. ## h5utils 1.3 ## *1/21/00* * You can now specify individual datasets within a file by using ''filename'':''dataset'' instead of just ''filename'' with `h5topng`, `h5totxt`, and `h5tov5d`. ## h5utils 1.2.3 ## *1/20/00* * Fixed minor bug in '`h5totxt -h`'. ## h5utils 1.2.2 ## *1/12/00* * `Makefile` now includes `CPPFLAGS` in the compiler flags, making it easier to use header files in non-standard locations. (`CPPFLAGS` is the proper place to put `-I` flags for the configure script.) ## h5utils 1.2.1 ## *1/1/00* * Modified `-o` option of `h5tov5d` to join datasets into a single Vis5d file. ## h5utils 1.2 ## *12/31/99* * Added h5tov5d program for converting to Vis5d format. * Improved installation; `h5read.oct` now goes into the sitewide Octave plugins directory, and things work correctly when only some of the utilities are compiled. ## h5utils 1.1 ## *12/6/99* * Added `h5totxt` program for exporting 2d slices of HDF5 files to text suitable for importing into a spreadsheet. ## h5utils 1.0 ## *11/22/99* * Initial release. h5utils-1.13.2/README.md000066400000000000000000000175671436105706500145010ustar00rootroot00000000000000![logo](doc/images/H5utils-logo.png) # H5utils **h5utils** is a set of utilities for visualization and conversion of scientific data in the free, portable [HDF5 format](http://www.hdfgroup.org/HDF5/). Besides providing a simple tool for batch visualization as [PNG](https://en.wikipedia.org/wiki/Portable_Network_Graphics) images, h5utils also includes programs to convert HDF5 datasets into the formats required by other free visualization software (e.g. plain text, [Vis5d](http://www.ssec.wisc.edu/~billh/vis5d.html), and [VTK](http://public.kitware.com/VTK/)). This package is developed by [Steven G. Johnson](http://math.mit.edu/~stevenj/), and is [free software](http://www.gnu.org/philosophy/free-sw.html) that should easily install under any Unix-like operating system (*e.g.* GNU/Linux). # Download and Install The latest version is h5utils 1.13.1, which can be downloaded in source-code form at: * https://github.com/NanoComp/h5utils/releases/download/1.13.1/h5utils-1.13.1.tar.gz (Download this `.tar.gz` file rather than cloning the [git repo](https://github.com/NanoComp/h5utils) unless you are a developer, since the git repo requires additional tools to build as described below.) What's new in each version is described in the [release notes](NEWS.md) file. h5utils is free software (a.k.a. [open source](http://www.opensource.org/)); see below for the license and copyright. ## Installation h5utils is designed for Unix-like operating systems (*e.g.* GNU/Linux). We do not support Windows directly, although you may be able to install there too using free packages like [Cygwin](http://cygwin.com/). You must first download and install [HDF5](http://www.hdfgroup.org/HDF5/), if it is not already on your system. Also, the programs to convert (see below) to/from [PNG](http://www.libpng.org/pub/png/), [Vis5d](http://www.ssec.wisc.edu/~billh/vis5d.html), [GNU Octave](http://www.octave.org/), and [HDF(4)](http://www.hdfgroup.org/products/hdf4/) will only be built if the corresponding libraries/programs are installed. `h5math` will only be built if [GNU libmatheval](http://www.gnu.org/software/libmatheval/) is installed. To compile and install the package, you then just type the usual GNU build commands: ``` ./configure make make install ``` See `./configure --help` for more options. You can use `make uninstall` to get rid of all the installed files. **Github**: If you are using the source [on github](https://github.com/NanoComp/h5utils) (via `git clone https://github.com/NanoComp/h5utils`), then you will also need to have [GNU autoconf, automake, and libtool](https://en.wikipedia.org/wiki/GNU_Build_System) installed, and run `sh autogen.sh` (in a Unix shell) to set up things before running `make` above (`autogen.sh` runs `./configure` for you). **Note:** if you get a message like `cannot compute sizeof (unsigned long)` when running `./configure`, it probably means you didn't install the HDF5 library properly: you need to tell the runtime linker where to find it. On GNU/Linux, make sure there is a line `/usr/local/lib` in `/etc/ld.so.conf` and run `/sbin/ldconfig` (assuming you installed HDF5 in the default location). *Note:* if you installed the [MPI](https://en.wikipedia.org/wiki/Message_Passing_Interface) (parallel) version of HDF5, you may get an error like `/usr/include/H5public.h:53:20: error: mpi.h: No such file or directory`. This can be fixed by telling the compiler where to find the MPI header files, e.g. via: `./configure CC=mpicc`. # h5utils Programs The included utilities are: * **h5totxt** and **h5fromtxt**: convert HDF5 datasets to/from ASCII text (e.g. comma- or tab-delimited). See the manual pages of [h5totxt](doc/h5totxt-man.md) and [h5fromtxt](doc/h5fromtxt-man.md) for more information. * **h5topng**: convert 2d slices of HDF5 datasets to PNG images, with a variety of color tables and other options. See the [h5topng manual page](doc/h5topng-man.md) for more information. See [Color tables in h5topng](doc/h5topng-colors.md) for information on the color tables. * **h5tov5d**: convert HDF5 datasets to the format used by the free 3d+ visualization tool [Vis5d](http://www.ssec.wisc.edu/~billh/vis5d.html). See the [manual page](doc/h5tov5d-man.md) for more information. **Note**: to install h5tov5d you must have first compiled Vis5d, and you must specify `--with-v5d=dir` to the h5utils `configure` script to specify the location `dir` of the Vis5d source directory. * **h5tovtk**: convert HDF5 datasets to VTK format for use by the free [Visualization ToolKit](http://public.kitware.com/VTK/) (along with supporting programs like [MayaVi](http://mayavi.sourceforge.net/)). See the [manual page](doc/h5tovtk-man.md) for more information. * **h5math**: create and combine HDF5 datasets with simple (pointwise) mathematical expressions. (Requires [GNU libmatheval](http://www.gnu.org/software/libmatheval/) to be installed.) See the [manual page](doc/h5math-man.md) for more information. * **h5read.oct**: a plug-in for [GNU Octave](http://www.octave.org/) (a Matlab-like program) to read 2d slices of HDF5 datasets. (Recent versions of Octave also include native support for HDF5, although it can't read slices like the `h5read` plug-in.) * **h5fromh4** and **h4fromh5**: convert HDF (version 4) datasets to and from HDF5. These utilities are nowadays somewhat redundant with the [h4toh5](http://hdfgroup.com/h4toh5/) and `h5toh4` programs provided by NCSA and the HDF Group (which are no longer bundled with HDF5, however). See the [h5fromh4](doc/h5fromh4-man.md) and [h4fromh5](doc/h4fromh5-man.md) manual pages for more information. To convert HDF5 to [CDF](http://nssdc.gsfc.nasa.gov/cdf/cdf_home.html) format, see the [hdf5-to-cdf](http://nssdc.gsfc.nasa.gov/cdf/html/FAQ.html#hdf5tocdf) program. # License and Copyright h5utils is Copyright © 1999–2023 Massachusetts Institute of Technology. *The following [MIT/expat license](https://opensource.org/licenses/MIT) governs the entire contents of h5utils except for the `h5tov5d.c` file. See below.* > Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: > >The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. > >THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *The file `h5tov5d.c` and the resulting `h5tov5d` binary are under the following different license, the [GNU GPL](http://www.gnu.org/copyleft/gpl.html) since they link with files from the GPL-covered Vis5d:* >This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. > >This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. > >You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. You can also find it on the GNU web site: http://www.gnu.org/copyleft/gpl.html h5utils-1.13.2/arrayh4.c000066400000000000000000000142571436105706500147310ustar00rootroot00000000000000/* Copyright (c) 1999-2023 Massachusetts Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include #include #include "config.h" #include "arrayh4.h" #ifdef VERBOSE # define WHEN_VERBOSE(x) x #else # define WHEN_VERBOSE(x) #endif int arrayh4_create(arrayh4 *b, int32 numtype, intn rank, const int32 *dims) { int i; b->rank = rank; b->N = 1; for (i = 0; i < rank; ++i) { b->dims[i] = dims[i]; b->N *= dims[i]; if (numtype == DFNT_FLOAT64) b->scale.d[i] = NULL; else b->scale.f[i] = NULL; } b->numtype = numtype; if (numtype == DFNT_FLOAT64) { b->p.d = (float64 *) malloc(b->N * sizeof(float64)); if (!b->p.d) return 0; } else if (numtype == DFNT_FLOAT32) { b->p.f = (float32 *) malloc(b->N * sizeof(float32)); if (!b->p.f) return 0; } return 1; } int arrayh4_clone(arrayh4 *b, arrayh4 a) { int dim, i; i = arrayh4_create(b, a.numtype, a.rank, a.dims); if (!i) return 0; /* copy the axes scales: */ if (a.numtype == DFNT_FLOAT64) { for (dim = 0; dim < a.rank; ++dim) if (a.scale.d[dim]) { b->scale.d[dim] = (float64 *) malloc(a.dims[dim] * sizeof(float64)); if (!b->scale.d[dim]) return 0; for (i = 0; i < a.dims[dim]; ++i) b->scale.d[dim][i] = a.scale.d[dim][i]; } } else if (a.numtype == DFNT_FLOAT32) { for (dim = 0; dim < a.rank; ++dim) if (a.scale.f[dim]) { b->scale.f[dim] = (float32 *) malloc(a.dims[dim] * sizeof(float32)); if (!b->scale.f[dim]) return 0; for (i = 0; i < a.dims[dim]; ++i) b->scale.f[dim][i] = a.scale.f[dim][i]; } } return 1; } void arrayh4_destroy(arrayh4 a) { int i; if (a.numtype == DFNT_FLOAT64) { free(a.p.d); for (i = 0; i < a.rank; ++i) free(a.scale.d[i]); } else if (a.numtype == DFNT_FLOAT32) { free(a.p.f); for (i = 0; i < a.rank; ++i) free(a.scale.f[i]); } } int arrayh4_read(char *fname, arrayh4 *a, int require_rank) { int32 numtype; intn rank; int32 dims[ARRAYH4_MAX_RANK]; int dim; WHEN_VERBOSE(printf("Reading arrayh4 from \"%s\"...\n", fname)); if (require_rank < 0 || require_rank > ARRAYH4_MAX_RANK) return 0; DFSDclear(); DFSDgetdims(fname, &rank, dims, ARRAYH4_MAX_RANK); WHEN_VERBOSE(printf(" rank = %d", rank)); if (require_rank && require_rank != rank) return 0; WHEN_VERBOSE(printf(", dimensions are ")); for (dim = 0; dim < rank; ++dim) { WHEN_VERBOSE(printf("%s%d", dim ? "x" : "", (int) dims[dim])); } WHEN_VERBOSE(printf("\n")); DFSDgetNT(&numtype); arrayh4_create(a, numtype, rank, dims); if (a->numtype == DFNT_FLOAT64) { WHEN_VERBOSE(printf(" double precision\n")); DFSDgetdata(fname, a->rank, a->dims, (VOIDP) a->p.d); for (dim = 0; dim < a->rank; ++dim) { a->scale.d[dim] = (float64 *) malloc(a->dims[dim] * sizeof(float64)); if (FAIL == DFSDgetdimscale(dim+1, a->dims[dim], (VOIDP) a->scale.d[dim])) { free(a->scale.d[dim]); a->scale.d[dim] = NULL; } } } else if (a->numtype == DFNT_FLOAT32) { WHEN_VERBOSE(printf(" single precision\n")); DFSDgetdata(fname, a->rank, a->dims, (VOIDP) a->p.f); for (dim = 0; dim < a->rank; ++dim) { a->scale.f[dim] = (float32 *) malloc(a->dims[dim] * sizeof(float32)); if (FAIL == DFSDgetdimscale(dim+1, a->dims[dim], (VOIDP) a->scale.f[dim])) { free(a->scale.f[dim]); a->scale.f[dim] = NULL; } } } else return 0; return 1; } #define MIN2(a,b) ((a) < (b) ? (a) : (b)) #define MAX2(a,b) ((a) > (b) ? (a) : (b)) int arrayh4_write(char *fname, arrayh4 a) { int i; WHEN_VERBOSE(printf("Writing arrayh4 to \"%s\"...\n", fname)); remove(fname); DFSDclear(); DFSDsetdims(a.rank, a.dims); DFSDsetNT(a.numtype); if (a.numtype == DFNT_FLOAT64) { float64 minval = 1e40, maxval = -1e40; for (i = 0; i < a.N; ++i) { minval = MIN2(minval, a.p.d[i]); maxval = MAX2(maxval, a.p.d[i]); } DFSDsetrange(&maxval, &minval); DFSDadddata(fname, a.rank, a.dims, (VOIDP) a.p.d); for (i = 0; i < a.rank; ++i) if (a.scale.d[i]) DFSDgetdimscale(i+1, a.dims[i], (VOIDP) a.scale.d[i]); } else if (a.numtype == DFNT_FLOAT32) { float32 minval = 1e20, maxval = -1e20; for (i = 0; i < a.N; ++i) { minval = MIN2(minval, a.p.f[i]); maxval = MAX2(maxval, a.p.f[i]); } DFSDsetrange(&maxval, &minval); DFSDadddata(fname, a.rank, a.dims, (VOIDP) a.p.f); for (i = 0; i < a.rank; ++i) if (a.scale.f[i]) DFSDgetdimscale(i+1, a.dims[i], (VOIDP) a.scale.f[i]); } else return 0; return 1; } short arrayh4_conformant(arrayh4 a, arrayh4 b) { int dim; if (a.numtype != b.numtype || a.N != b.N || a.rank != b.rank) return 0; for (dim = 0; dim < a.rank; ++dim) if (a.dims[dim] != b.dims[dim]) return 0; return 1; } h5utils-1.13.2/arrayh4.h000066400000000000000000000035751436105706500147370ustar00rootroot00000000000000/* Copyright (c) 1999-2023 Massachusetts Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef ARRAYH4_H #define ARRAYH4_H #if defined(HAVE_HDF_H) # include #elif defined(HAVE_HDF_HDF_H) # include #endif #define ARRAYH4_MAX_RANK 10 typedef struct { int32 numtype; intn rank; int32 dims[ARRAYH4_MAX_RANK]; int N; union { float32 *f; float64 *d; } p; union { float32 *f[ARRAYH4_MAX_RANK]; float64 *d[ARRAYH4_MAX_RANK]; } scale; } arrayh4; extern int arrayh4_create(arrayh4 *b, int32 numtype, intn rank, const int32 *dims); extern int arrayh4_clone(arrayh4 *b, arrayh4 a); extern void arrayh4_destroy(arrayh4 a); extern int arrayh4_read(char *fname, arrayh4 *a, int require_rank); extern int arrayh4_write(char *fname, arrayh4 a); extern short arrayh4_conformant(arrayh4 a, arrayh4 b); #endif h5utils-1.13.2/arrayh5.c000066400000000000000000000256541436105706500147350ustar00rootroot00000000000000/* Copyright (c) 1999-2008 Massachusetts Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include #include /* don't use new HDF5 1.8 API (which isn't even fully documented yet, grrr) */ #define H5_USE_16_API 1 #include #include "arrayh5.h" #define CHECK(cond, msg) { if (!(cond)) { fprintf(stderr, "arrayh5 error: %s\n", msg); exit(EXIT_FAILURE); } } #define CHK_MALLOC(p, t, n) CHECK(p = (t *) malloc(sizeof(t) * (n)), "out of memory") /* Normally, HDF5 prints out all sorts of error messages, e.g. if a dataset can't be found, in addition to returning an error code. The following macro can be wrapped around code to temporarily suppress error messages. */ #define SUPPRESS_HDF5_ERRORS(statements) { \ H5E_auto_t xxxxx_err_func; \ void *xxxxx_err_func_data; \ H5Eget_auto(&xxxxx_err_func, &xxxxx_err_func_data); \ H5Eset_auto(NULL, NULL); \ { statements; } \ H5Eset_auto(xxxxx_err_func, xxxxx_err_func_data); \ } arrayh5 arrayh5_create_withdata(int rank, const int *dims, double *data) { arrayh5 a; int i; CHECK(rank >= 0, "non-positive rank"); a.rank = rank; CHK_MALLOC(a.dims, int, rank); a.N = 1; for (i = 0; i < rank; ++i) { a.dims[i] = dims[i]; a.N *= dims[i]; } if (data) a.data = data; else { CHK_MALLOC(a.data, double, a.N); } return a; } arrayh5 arrayh5_create(int rank, const int *dims) { return arrayh5_create_withdata(rank, dims, NULL); } arrayh5 arrayh5_clone(arrayh5 a) { arrayh5 b = arrayh5_create(a.rank, a.dims); if (a.data) memcpy(b.data, a.data, sizeof(double) * a.N); return b; } void arrayh5_destroy(arrayh5 a) { free(a.dims); free(a.data); } int arrayh5_conformant(arrayh5 a, arrayh5 b) { int i; if (a.rank != b.rank) return 0; for (i = 0; i < a.rank; ++i) if (a.dims[i] != b.dims[i]) return 0; return 1; } static void rtranspose(int curdim, int rank, const int *dims, int curindex, int curindex_t, const double *data, double *data_t) { int prod_before = 1, prod_after = 1; int i; if (rank == 0) { *data_t = *data; return; } for (i = 0; i < curdim; ++i) prod_before *= dims[i]; for (i = curdim + 1; i < rank; ++i) prod_after *= dims[i]; if (curdim == rank - 1) { for (i = 0; i < dims[curdim]; ++i) data_t[curindex_t + i * prod_before] = data[curindex + i]; } else { for (i = 0; i < dims[curdim]; ++i) rtranspose(curdim + 1, rank, dims, curindex + i * prod_after, curindex_t + i * prod_before, data, data_t); } } void arrayh5_transpose(arrayh5 *a) { double *data_t; int i; CHK_MALLOC(data_t, double, a->N); rtranspose(0, a->rank, a->dims, 0, 0, a->data, data_t); free(a->data); a->data = data_t; for (i = 0; i < a->rank - 1 - i; ++i) { int dummy = a->dims[i]; a->dims[i] = a->dims[a->rank - 1 - i]; a->dims[a->rank - 1 - i] = dummy; } } void arrayh5_getrange(arrayh5 a, double *min, double *max) { int i; CHECK(a.N > 0, "no elements in array"); *min = *max = a.data[0]; for (i = 1; i < a.N; ++i) { if (a.data[i] < *min) *min = a.data[i]; if (a.data[i] > *max) *max = a.data[i]; } } static herr_t find_dataset(hid_t group_id, const char *name, void *d) { char **dname = (char **) d; H5G_stat_t info; H5Gget_objinfo(group_id, name, 1, &info); if (info.type == H5G_DATASET) { CHK_MALLOC(*dname, char, strlen(name) + 1); strcpy(*dname, name); return 1; } return 0; } typedef enum { NO_ERROR = 0, OPEN_FAILED, NO_DATA, READ_FAILED, SLICE_FAILED, INVALID_SLICE, INVALID_RANK, OPEN_DATA_FAILED } arrayh5_err; const char arrayh5_read_strerror[][100] = { "no error", "error opening HD5 file", "couldn't find data set in HDF5 file", "error reading data from HDF5", "error reading data slice from HDF5", "invalid slice of HDF5 data", "non-positive rank in HDF file", "error opening data set in HDF file", }; int arrayh5_read(arrayh5 *a, const char *fname, const char *datapath, char **dataname, int nslicedims_, const int *slicedim_, const int *islice_, const int *center_slice) { hid_t file_id = -1, data_id = -1, space_id = -1; char *dname = NULL; int err = NO_ERROR; hsize_t i, rank, *dims_copy, *maxdims, *slicedim = 0; int *islice = 0; int *dims = 0; hsize_t nslicedims = (hsize_t) nslicedims_; CHECK(a, "NULL array passed to arrayh5_read"); a->dims = NULL; a->data = NULL; file_id = H5Fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT); if (file_id < 0) { err = OPEN_FAILED; goto done; } if (datapath && datapath[0]) { CHK_MALLOC(dname, char, strlen(datapath) + 1); strcpy(dname, datapath); } else { if (H5Giterate(file_id, "/", NULL, find_dataset, &dname) <= 0) { err = NO_DATA; goto done; } } data_id = H5Dopen(file_id, dname); if (data_id < 0) { err = OPEN_DATA_FAILED; goto done; } space_id = H5Dget_space(data_id); rank = H5Sget_simple_extent_ndims(space_id); if (rank <= 0) { err = INVALID_RANK; goto done; } CHK_MALLOC(dims, int, rank); CHK_MALLOC(dims_copy, hsize_t, rank); CHK_MALLOC(maxdims, hsize_t, rank); H5Sget_simple_extent_dims(space_id, dims_copy, maxdims); for (i = 0; i < rank; ++i) dims[i] = dims_copy[i]; free(maxdims); free(dims_copy); for (i = 0; i < nslicedims && slicedim_[i] == NO_SLICE_DIM; ++i) ; if (i == nslicedims) { /* no slices */ *a = arrayh5_create(rank, dims); if (H5Dread(data_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, (void *) a->data) < 0) { err = READ_FAILED; goto done; } } else if (nslicedims > 0) { int j, rank2 = rank; hsize_t *start; hsize_t *count; hid_t mem_space_id; herr_t readerr; CHK_MALLOC(slicedim, hsize_t, nslicedims); CHK_MALLOC(islice, int, nslicedims); for (i = j = 0; i < nslicedims; ++i) if (slicedim_[i] != NO_SLICE_DIM) { if (slicedim_[i] == LAST_SLICE_DIM) slicedim[j] = rank - 1; else slicedim[j] = (hsize_t) slicedim_[i]; if (slicedim[j] >= rank) { err = INVALID_SLICE; goto done; } islice[j] = islice_[i]; if (center_slice[i]) islice[j] += dims[slicedim[j]] / 2; if (islice[j] < 0 || islice[j] >= dims[slicedim[j]]) { err = INVALID_SLICE; goto done; } j++; } nslicedims = j; CHK_MALLOC(start, hsize_t, rank); CHK_MALLOC(count, hsize_t, rank); for (i = 0; i < rank; ++i) { count[i] = dims[i]; start[i] = 0; } for (i = 0; i < nslicedims; ++i) { start[slicedim[i]] = islice[i]; count[slicedim[i]] = 1; } H5Sselect_hyperslab(space_id, H5S_SELECT_SET, start, NULL, count, NULL); for (i = j = 0; i < rank; ++i) if (count[i] > 1) dims[j++] = count[i]; rank2 = j; *a = arrayh5_create(rank2, dims); mem_space_id = H5Screate_simple(rank, count, NULL); H5Sselect_all(mem_space_id); readerr = H5Dread(data_id, H5T_NATIVE_DOUBLE, mem_space_id, space_id, H5P_DEFAULT, (void *) a->data); H5Sclose(mem_space_id); free(count); free(start); if (readerr < 0) { err = SLICE_FAILED; goto done; } } else { err = INVALID_SLICE; goto done; } done: if (err != NO_ERROR) arrayh5_destroy(*a); free(islice); free(slicedim); free(dims); if (space_id >= 0) H5Sclose(space_id); if (data_id >= 0) H5Dclose(data_id); if (dataname) *dataname = dname; else free(dname); if (file_id >= 0) H5Fclose(file_id); return err; } static int dataset_exists(hid_t id, const char *name) { hid_t data_id; SUPPRESS_HDF5_ERRORS(data_id = H5Dopen(id, name)); if (data_id >= 0) H5Dclose(data_id); return (data_id >= 0); } void arrayh5_write(arrayh5 a, char *filename, char *dataname, short append_data) { int i; hid_t file_id, space_id, type_id, data_id; hsize_t *dims_copy; if (append_data) file_id = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT); else file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); CHECK(file_id >= 0, "error opening HDF5 output file"); if (dataset_exists(file_id, dataname)) H5Gunlink(file_id, dataname); /* delete it */ CHECK(a.rank > 0, "non-positive rank"); CHK_MALLOC(dims_copy, hsize_t, a.rank); for (i = 0; i < a.rank; ++i) dims_copy[i] = a.dims[i]; space_id = H5Screate_simple(a.rank, dims_copy, NULL); free(dims_copy); type_id = H5T_NATIVE_DOUBLE; data_id = H5Dcreate(file_id, dataname, type_id, space_id, H5P_DEFAULT); H5Sclose(space_id); H5Dwrite(data_id, type_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, a.data); H5Dclose(data_id); H5Fclose(file_id); } int arrayh5_read_rank(const char *fname, const char *datapath, int *rank) { hid_t file_id = -1, data_id = -1, space_id = -1; char *dname = NULL; int err = NO_ERROR; file_id = H5Fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT); if (file_id < 0) { err = OPEN_FAILED; goto done; } if (datapath && datapath[0]) { CHK_MALLOC(dname, char, strlen(datapath) + 1); strcpy(dname, datapath); } else { if (H5Giterate(file_id, "/", NULL, find_dataset, &dname) <= 0) { err = NO_DATA; goto done; } } data_id = H5Dopen(file_id, dname); if (data_id < 0) { err = OPEN_DATA_FAILED; goto done; } space_id = H5Dget_space(data_id); *rank = H5Sget_simple_extent_ndims(space_id); done: if (space_id >= 0) H5Sclose(space_id); if (data_id >= 0) H5Dclose(data_id); free(dname); if (file_id >= 0) H5Fclose(file_id); return err; } h5utils-1.13.2/arrayh5.h000066400000000000000000000045341436105706500147340ustar00rootroot00000000000000/* Copyright (c) 1999-2023 Massachusetts Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef ARRAYH5_H #define ARRAYH5_H #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ /***********************************************************************/ typedef struct { int rank, *dims, N; double *data; } arrayh5; extern arrayh5 arrayh5_create_withdata(int rank, const int *dims,double *data); extern arrayh5 arrayh5_create(int rank, const int *dims); extern arrayh5 arrayh5_clone(arrayh5 a); extern void arrayh5_transpose(arrayh5 *a); extern void arrayh5_destroy(arrayh5 a); extern int arrayh5_conformant(arrayh5 a, arrayh5 b); extern void arrayh5_getrange(arrayh5 a, double *min, double *max); extern const char arrayh5_read_strerror[][100]; extern int arrayh5_read(arrayh5 *a, const char *fname, const char *datapath, char **dataname, int nslicedims, const int *slicedim, const int *islice, const int *center_slice); extern void arrayh5_write(arrayh5 a, char *filename, char *dataname, short append_data); int arrayh5_read_rank(const char *fname, const char *datapath, int *rank); #define NO_SLICE_DIM -1 #define LAST_SLICE_DIM -2 /***********************************************************************/ #ifdef __cplusplus } /* extern "C" */ #endif /* __cplusplus */ #endif /* ARRAYH5_H */ h5utils-1.13.2/autogen.sh000077500000000000000000000004341436105706500152040ustar00rootroot00000000000000#!/bin/sh # paranoia: sometimes autoconf doesn't get things right the first time autoreconf --verbose --install --symlink --force autoreconf --verbose --install --symlink --force autoreconf --verbose --install --symlink --force ./configure --with-hdf4 --enable-maintainer-mode "$@" h5utils-1.13.2/colormaps/000077500000000000000000000000001436105706500152015ustar00rootroot00000000000000h5utils-1.13.2/colormaps/BrBG000066400000000000000000000357371436105706500157170ustar00rootroot00000000000000# BrBG colormap (based on Matplotlib colormap of the same name) 0.32941176470588235 0.18823529411764706 0.0196078431372549 1 0.3380238369857747 0.1933102652825836 0.020376778162245292 1 0.34663590926566706 0.19838523644752018 0.02114571318723568 1 0.3552479815455594 0.20346020761245676 0.021914648212226065 1 0.3638600538254517 0.2085351787773933 0.022683583237216455 1 0.3724721261053441 0.21361014994232985 0.02345251826220684 1 0.38108419838523644 0.21868512110726643 0.02422145328719723 1 0.3896962706651288 0.223760092272203 0.02499038831218762 1 0.39830834294502115 0.22883506343713955 0.02575932333717801 1 0.4069204152249135 0.23391003460207613 0.0265282583621684 1 0.41553248750480587 0.23898500576701268 0.027297193387158785 1 0.4241445597846982 0.24405997693194925 0.02806612841214917 1 0.4327566320645906 0.2491349480968858 0.02883506343713956 1 0.4413687043444829 0.25420991926182235 0.02960399846212995 1 0.4499807766243753 0.25928489042675895 0.03037293348712034 1 0.45859284890426766 0.2643598615916955 0.031141868512110725 1 0.46720492118415996 0.26943483275663205 0.031910803537101115 1 0.4758169934640523 0.2745098039215686 0.0326797385620915 1 0.4844290657439447 0.2795847750865052 0.033448673587081895 1 0.49304113802383703 0.28465974625144175 0.03421760861207228 1 0.5016532103037293 0.2897347174163783 0.03498654363706267 1 0.5102652825836217 0.29480968858131484 0.03575547866205306 1 0.518877354863514 0.29988465974625145 0.03652441368704344 1 0.5274894271434064 0.304959630911188 0.03729334871203383 1 0.5361014994232988 0.31003460207612454 0.03806228373702422 1 0.5447135717031911 0.31510957324106115 0.038831218762014605 1 0.5529411764705883 0.3213379469434833 0.041906958861976165 1 0.5607843137254902 0.328719723183391 0.04728950403690888 1 0.5686274509803922 0.3361014994232987 0.0526720492118416 1 0.5764705882352942 0.34348327566320647 0.05805459438677432 1 0.5843137254901961 0.3508650519031142 0.06343713956170705 1 0.592156862745098 0.3582468281430219 0.06881968473663976 1 0.6000000000000001 0.3656286043829296 0.07420222991157246 1 0.6078431372549019 0.3730103806228373 0.07958477508650516 1 0.615686274509804 0.3803921568627451 0.08496732026143791 1 0.6235294117647059 0.3877739331026528 0.09034986543637064 1 0.6313725490196078 0.3951557093425605 0.09573241061130335 1 0.6392156862745098 0.4025374855824682 0.10111495578623603 1 0.6470588235294118 0.409919261822376 0.10649750096116878 1 0.6549019607843137 0.4173010380622837 0.1118800461361015 1 0.6627450980392157 0.42468281430219146 0.11726259131103423 1 0.6705882352941176 0.4320645905420991 0.12264513648596691 1 0.6784313725490196 0.4394463667820069 0.12802768166089967 1 0.6862745098039216 0.44682814302191465 0.13341022683583237 1 0.6941176470588235 0.45420991926182236 0.1387927720107651 1 0.7019607843137254 0.46159169550173007 0.14417531718569776 1 0.7098039215686275 0.46897347174163784 0.14955786236063054 1 0.7176470588235294 0.47635524798154555 0.15494040753556326 1 0.7254901960784313 0.48373702422145326 0.16032295271049596 1 0.7333333333333333 0.4911188004613609 0.16570549788542865 1 0.7411764705882353 0.49850057670126874 0.1710880430603614 1 0.7490196078431373 0.5058823529411764 0.17647058823529413 1 0.7539407920030757 0.5158785082660515 0.18877354863514034 1 0.7588619761630142 0.5258746635909265 0.20107650903498644 1 0.7637831603229527 0.5358708189158016 0.21337946943483274 1 0.7687043444828912 0.5458669742406767 0.22568242983467895 1 0.7736255286428296 0.5558631295655516 0.23798539023452514 1 0.7785467128027681 0.5658592848904266 0.25028835063437127 1 0.7834678969627067 0.5758554402153018 0.26259131103421757 1 0.7883890811226452 0.5858515955401767 0.27489427143406375 1 0.7933102652825836 0.5958477508650518 0.28719723183391 1 0.798231449442522 0.6058439061899268 0.2995001922337561 1 0.8031526336024606 0.6158400615148019 0.31180315263360237 1 0.8080738177623991 0.6258362168396769 0.3241061130334486 1 0.8129950019223375 0.635832372164552 0.33640907343329485 1 0.817916186082276 0.6458285274894271 0.34871203383314103 1 0.8228373702422145 0.655824682814302 0.36101499423298705 1 0.827758554402153 0.6658208381391771 0.37331795463283346 1 0.8326797385620914 0.6758169934640521 0.3856209150326796 1 0.8376009227220299 0.6858131487889272 0.39792387543252583 1 0.8425221068819684 0.6958093041138023 0.41022683583237207 1 0.847443291041907 0.7058054594386773 0.4225297962322182 1 0.8523644752018453 0.7158016147635523 0.43483275663206444 1 0.8572856593617839 0.7257977700884274 0.4471357170319107 1 0.8622068435217223 0.7357939254133022 0.4594386774317567 1 0.8671280276816609 0.7457900807381774 0.47174163783160306 1 0.8720492118415993 0.7557862360630525 0.4840445982314493 1 0.8762783544790465 0.7637062668204535 0.4955786236063051 1 0.8798154555940023 0.7695501730103805 0.5063437139561705 1 0.8833525567089581 0.7753940792003075 0.517108804306036 1 0.8868896578239138 0.7812379853902344 0.5278738946559014 1 0.8904267589388696 0.7870818915801614 0.5386389850057669 1 0.8939638600538253 0.7929257977700882 0.5494040753556322 1 0.8975009611687812 0.7987697039600152 0.5601691657054977 1 0.901038062283737 0.8046136101499423 0.5709342560553632 1 0.9045751633986928 0.8104575163398692 0.5816993464052287 1 0.9081122645136486 0.8163014225297962 0.5924644367550941 1 0.9116493656286043 0.8221453287197231 0.6032295271049595 1 0.9151864667435602 0.82798923490965 0.613994617454825 1 0.9187235678585159 0.833833141099577 0.6247597078046904 1 0.9222606689734717 0.8396770472895039 0.6355247981545558 1 0.9257977700884276 0.8455209534794309 0.6462898885044213 1 0.9293348712033833 0.8513648596693579 0.6570549788542868 1 0.9328719723183391 0.8572087658592848 0.6678200692041522 1 0.9364090734332948 0.8630526720492118 0.6785851595540175 1 0.9399461745482507 0.8688965782391388 0.689350249903883 1 0.9434832756632064 0.8747404844290657 0.7001153402537484 1 0.9470203767781622 0.8805843906189926 0.7108804306036139 1 0.950557477893118 0.8864282968089195 0.7216455209534792 1 0.9540945790080738 0.8922722029988466 0.7324106113033448 1 0.9576316801230296 0.8981161091887735 0.7431757016532102 1 0.9611687812379854 0.9039600153787005 0.7539407920030756 1 0.9647058823529412 0.9098039215686274 0.7647058823529411 1 0.9645520953479431 0.9118031526336025 0.772395232602845 1 0.964398308342945 0.9138023836985775 0.7800845828527488 1 0.9642445213379469 0.9158016147635525 0.7877739331026528 1 0.9640907343329489 0.9178008458285275 0.7954632833525566 1 0.9639369473279508 0.9198000768935025 0.8031526336024606 1 0.9637831603229527 0.9217993079584775 0.8108419838523644 1 0.9636293733179546 0.9237985390234525 0.8185313341022683 1 0.9634755863129566 0.9257977700884276 0.8262206843521722 1 0.9633217993079585 0.9277970011534026 0.8339100346020761 1 0.9631680123029605 0.9297962322183776 0.84159938485198 1 0.9630142252979623 0.9317954632833526 0.8492887351018839 1 0.9628604382929643 0.9337946943483275 0.8569780853517877 1 0.9627066512879662 0.9357939254133025 0.8646674356016917 1 0.9625528642829682 0.9377931564782775 0.8723567858515955 1 0.96239907727797 0.9397923875432526 0.8800461361014994 1 0.962245290272972 0.9417916186082276 0.8877354863514033 1 0.9620915032679739 0.9437908496732026 0.8954248366013071 1 0.9619377162629758 0.9457900807381776 0.9031141868512111 1 0.9617839292579777 0.9477893118031526 0.910803537101115 1 0.9616301422529796 0.9497885428681276 0.9184928873510187 1 0.9614763552479816 0.9517877739331027 0.9261822376009228 1 0.9613225682429835 0.9537870049980777 0.9338715878508266 1 0.9611687812379854 0.9557862360630527 0.9415609381007305 1 0.9610149942329873 0.9577854671280277 0.9492502883506344 1 0.9608612072279893 0.9597846981930027 0.9569396386005382 1 0.9572472126105345 0.9599384851980008 0.9595540176855056 1 0.9501730103806229 0.958246828143022 0.9570934256055363 1 0.9430988081507113 0.9565551710880431 0.9546328335255672 1 0.9360246059207997 0.9548635140330642 0.9521722414455979 1 0.9289504036908884 0.9531718569780854 0.9497116493656287 1 0.9218762014609766 0.9514801999231065 0.9472510572856594 1 0.9148019992310651 0.9497885428681276 0.9447904652056902 1 0.9077277970011535 0.9480968858131488 0.9423298731257209 1 0.900653594771242 0.9464052287581699 0.9398692810457517 1 0.8935793925413303 0.9447135717031911 0.9374086889657824 1 0.8865051903114188 0.9430219146482123 0.9349480968858133 1 0.8794309880815072 0.9413302575932334 0.932487504805844 1 0.8723567858515957 0.9396386005382545 0.9300269127258747 1 0.8652825836216841 0.9379469434832757 0.9275663206459055 1 0.8582083813917726 0.9362552864282968 0.9251057285659362 1 0.851134179161861 0.9345636293733179 0.922645136485967 1 0.8440599769319495 0.9328719723183391 0.9201845444059977 1 0.8369857747020378 0.9311803152633603 0.9177239523260285 1 0.8299115724721262 0.9294886582083814 0.9152633602460593 1 0.8228373702422147 0.9277970011534026 0.9128027681660901 1 0.8157631680123033 0.9261053440984237 0.9103421760861209 1 0.8086889657823916 0.9244136870434448 0.9078815840061516 1 0.80161476355248 0.922722029988466 0.9054209919261823 1 0.7945405613225685 0.9210303729334871 0.9029603998462131 1 0.7874663590926568 0.9193387158785082 0.9004998077662438 1 0.7803921568627453 0.9176470588235294 0.8980392156862746 1 0.7694732795078819 0.9131872356785853 0.8925028835063439 1 0.7585544021530184 0.908727412533641 0.8869665513264131 1 0.7476355247981549 0.9042675893886968 0.8814302191464823 1 0.7367166474432914 0.8998077662437525 0.8758938869665515 1 0.7257977700884278 0.8953479430988083 0.8703575547866207 1 0.7148788927335643 0.890888119953864 0.8648212226066899 1 0.7039600153787008 0.8864282968089198 0.8592848904267592 1 0.6930411380238373 0.8819684736639755 0.8537485582468283 1 0.6821222606689737 0.8775086505190313 0.8482122260668975 1 0.6712033833141102 0.873048827374087 0.8426758938869667 1 0.660284505959247 0.8685890042291429 0.8371395617070361 1 0.6493656286043832 0.8641291810841984 0.8316032295271051 1 0.6384467512495198 0.8596693579392543 0.8260668973471743 1 0.6275278738946561 0.8552095347943101 0.8205305651672435 1 0.6166089965397927 0.8507497116493657 0.8149942329873128 1 0.6056901191849292 0.8462898885044216 0.8094579008073819 1 0.5947712418300657 0.8418300653594772 0.8039215686274511 1 0.5838523644752022 0.837370242214533 0.7983852364475204 1 0.5729334871203386 0.8329104190695887 0.7928489042675895 1 0.5620146097654751 0.8284505959246445 0.7873125720876587 1 0.5510957324106116 0.8239907727797002 0.7817762399077279 1 0.5401768550557481 0.819530949634756 0.7762399077277972 1 0.5292579777008846 0.8150711264898117 0.7707035755478664 1 0.518339100346021 0.8106113033448675 0.7651672433679355 1 0.5074202229911575 0.8061514801999232 0.7596309111880047 1 0.4961937716262979 0.7997693194925032 0.7530180699730875 1 0.48465974625144237 0.7914648212226072 0.7453287197231838 1 0.4731257208765862 0.7831603229527108 0.7376393694732797 1 0.4615916955017304 0.7748558246828146 0.7299500192233758 1 0.45005767012687453 0.7665513264129183 0.7222606689734719 1 0.4385236447520187 0.7582468281430221 0.714571318723568 1 0.4269896193771629 0.7499423298731259 0.7068819684736641 1 0.415455594002307 0.7416378316032297 0.6991926182237602 1 0.4039215686274512 0.7333333333333335 0.6915032679738563 1 0.3923875432525954 0.7250288350634373 0.6838139177239524 1 0.3808535178777395 0.7167243367935411 0.6761245674740486 1 0.3693194925028837 0.7084198385236449 0.6684352172241447 1 0.35778546712802783 0.7001153402537487 0.6607458669742408 1 0.346251441753172 0.6918108419838525 0.653056516724337 1 0.3347174163783162 0.6835063437139562 0.645367166474433 1 0.32318339100346033 0.67520184544406 0.6376778162245291 1 0.3116493656286045 0.6668973471741639 0.6299884659746252 1 0.300115340253749 0.658592848904268 0.6222991157247215 1 0.2885813148788928 0.6502883506343715 0.6146097654748175 1 0.277047289504037 0.6419838523644753 0.6069204152249136 1 0.2655132641291812 0.6336793540945791 0.5992310649750097 1 0.2539792387543254 0.6253748558246829 0.5915417147251057 1 0.2424452133794695 0.6170703575547867 0.5838523644752018 1 0.2309111880046137 0.6087658592848905 0.576163014225298 1 0.21937716262975787 0.6004613610149943 0.5684736639753941 1 0.207843137254902 0.592156862745098 0.5607843137254902 1 0.19984621299500194 0.5846212995001923 0.5532487504805844 1 0.1918492887351019 0.5770857362552865 0.5457131872356786 1 0.18385236447520187 0.5695501730103806 0.5381776239907727 1 0.1758554402153018 0.5620146097654748 0.530642060745867 1 0.16785851595540177 0.554479046520569 0.5231064975009612 1 0.15986159169550174 0.5469434832756632 0.5155709342560554 1 0.1518646674356017 0.5394079200307574 0.5080353710111496 1 0.1438677431757019 0.5318723567858519 0.5004998077662439 1 0.1358708189158016 0.5243367935409458 0.49296424452133797 1 0.1278738946559016 0.51680123029604 0.48542868127643213 1 0.11987697039600155 0.5092656670511342 0.47789311803152634 1 0.11188004613610152 0.5017301038062284 0.47035755478662056 1 0.10388312187620148 0.4941945405613226 0.4628219915417148 1 0.09588619761630142 0.4866589773164168 0.45528642829680893 1 0.0878892733564014 0.479123414071511 0.44775086505190315 1 0.07989234909650136 0.47158785082660515 0.4402153018069973 1 0.07189542483660133 0.46405228758169936 0.4326797385620915 1 0.06389850057670127 0.4565167243367936 0.42514417531718574 1 0.05590157631680123 0.44898116109188774 0.4176086120722799 1 0.0479046520569012 0.44144559784698195 0.4100730488273741 1 0.03990772779700116 0.4339100346020761 0.40253748558246827 1 0.03191080353710113 0.4263744713571703 0.3950019223375625 1 0.023913879277201094 0.41883890811226454 0.3874663590926567 1 0.015916955017301282 0.411303344867359 0.37993079584775113 1 0.007920030757401025 0.40376778162245297 0.3723952326028451 1 0.0038446751249519417 0.3967704728950404 0.36509034986543637 1 0.003690888119953864 0.39031141868512115 0.3580161476355248 1 0.003537101114955786 0.3838523644752019 0.35094194540561324 1 0.0033833141099577084 0.3773933102652826 0.3438677431757017 1 0.0032295271049596307 0.37093425605536334 0.3367935409457901 1 0.0030757400999615533 0.3644752018454441 0.32971933871587855 1 0.0029219530949634756 0.3580161476355248 0.32264513648596693 1 0.002768166089965398 0.35155709342560554 0.31557093425605537 1 0.0026143790849673205 0.34509803921568627 0.3084967320261438 1 0.0024605920799692423 0.338638985005767 0.30142252979623224 1 0.002306805074971165 0.33217993079584773 0.2943483275663207 1 0.0021530180699730873 0.3257208765859285 0.28727412533640906 1 0.0019992310649750095 0.31926182237600925 0.2801999231064975 1 0.0018454440599769317 0.31280276816609 0.27312572087658593 1 0.0016916570549788588 0.3063437139561709 0.26605151864667453 1 0.0015378700499807767 0.29988465974625145 0.2589773164167628 1 0.001384083044982699 0.2934256055363322 0.2519031141868512 1 0.0012302960399846212 0.2869665513264129 0.24482891195693965 1 0.0010765090349865438 0.2805074971164937 0.23775470972702809 1 0.0009227220299884661 0.2740484429065744 0.2306805074971165 1 0.0007689350249903883 0.26758938869665516 0.22360630526720493 1 0.0006151480199923106 0.26113033448673584 0.21653210303729334 1 0.00046136101499423326 0.2546712802768166 0.20945790080738177 1 0.0003075740099961555 0.24821222606689736 0.2023836985774702 1 0.00015378700499807775 0.2417531718569781 0.19530949634755862 1 0 0.23529411764705882 0.18823529411764706 1 h5utils-1.13.2/colormaps/RdBu000066400000000000000000000355571436105706500157770ustar00rootroot00000000000000# RdBu colormap (based on Matplotlib colormap of the same name) 0.403921568627451 0 0.12156862745098039 1 0.4154555940023068 0.003690888119953864 0.12341407151095732 1 0.4269896193771626 0.007381776239907728 0.12525951557093426 1 0.43852364475201844 0.011072664359861591 0.12710495963091117 1 0.45005767012687425 0.014763552479815456 0.12895040369088812 1 0.4615916955017301 0.01845444059976932 0.13079584775086506 1 0.47312572087658594 0.022145328719723183 0.132641291810842 1 0.48465974625144176 0.02583621683967705 0.1344867358708189 1 0.4961937716262976 0.02952710495963091 0.13633217993079585 1 0.5077277970011534 0.03321799307958478 0.13817762399077277 1 0.5192618223760093 0.03690888119953864 0.1400230680507497 1 0.5307958477508651 0.0405997693194925 0.14186851211072665 1 0.5423298731257209 0.044290657439446365 0.1437139561707036 1 0.5538638985005767 0.04798154555940023 0.1455594002306805 1 0.5653979238754325 0.0516724336793541 0.14740484429065745 1 0.5769319492502883 0.05536332179930796 0.14925028835063436 1 0.5884659746251442 0.05905420991926182 0.1510957324106113 1 0.6 0.06274509803921569 0.15294117647058825 1 0.6115340253748558 0.06643598615916955 0.1547866205305652 1 0.6230680507497116 0.07012687427912341 0.1566320645905421 1 0.6346020761245674 0.07381776239907728 0.15847750865051904 1 0.6461361014994232 0.07750865051903114 0.16032295271049596 1 0.6576701268742791 0.081199538638985 0.1621683967704729 1 0.669204152249135 0.08489042675893888 0.16401384083044984 1 0.6807381776239907 0.08858131487889273 0.16585928489042678 1 0.6922722029988466 0.09227220299884659 0.1677047289504037 1 0.7008073817762399 0.09965397923875433 0.17124183006535948 1 0.7063437139561707 0.11072664359861592 0.17647058823529413 1 0.7118800461361015 0.12179930795847752 0.18169934640522878 1 0.7174163783160322 0.1328719723183391 0.1869281045751634 1 0.7229527104959631 0.14394463667820068 0.19215686274509805 1 0.7284890426758939 0.15501730103806227 0.1973856209150327 1 0.7340253748558246 0.16608996539792387 0.20261437908496732 1 0.7395617070357554 0.1771626297577854 0.20784313725490194 1 0.7450980392156863 0.18823529411764706 0.2130718954248366 1 0.7506343713956171 0.19930795847750865 0.21830065359477124 1 0.7561707035755478 0.21038062283737025 0.22352941176470587 1 0.7617070357554786 0.22145328719723176 0.2287581699346405 1 0.7672433679354095 0.2325259515570934 0.23398692810457516 1 0.7727797001153403 0.243598615916955 0.2392156862745098 1 0.778316032295271 0.2546712802768166 0.24444444444444444 1 0.7838523644752018 0.2657439446366781 0.24967320261437903 1 0.7893886966551327 0.2768166089965398 0.2549019607843137 1 0.7949250288350634 0.28788927335640135 0.26013071895424833 1 0.8004613610149942 0.298961937716263 0.265359477124183 1 0.805997693194925 0.3100346020761245 0.2705882352941176 1 0.8115340253748559 0.3211072664359862 0.2758169934640523 1 0.8170703575547866 0.33217993079584773 0.28104575163398693 1 0.8226066897347174 0.34325259515570933 0.28627450980392155 1 0.8281430219146482 0.35432525951557087 0.2915032679738562 1 0.833679354094579 0.3653979238754325 0.29673202614379085 1 0.8392156862745098 0.3764705882352941 0.30196078431372547 1 0.8438292964244521 0.3870818915801615 0.3101114955786236 1 0.8484429065743945 0.39769319492502875 0.31826220684352163 1 0.8530565167243368 0.4083044982698962 0.3264129181084198 1 0.8576701268742791 0.41891580161476355 0.3345636293733179 1 0.8622837370242215 0.42952710495963087 0.34271434063821604 1 0.8668973471741638 0.44013840830449813 0.35086505190311407 1 0.8715109573241061 0.4507497116493656 0.35901576316801226 1 0.8761245674740484 0.46136101499423293 0.3671664744329104 1 0.8807381776239908 0.4719723183391003 0.3753171856978085 1 0.8853517877739331 0.48258362168396757 0.38346789696270656 1 0.8899653979238754 0.493194925028835 0.3916186082276047 1 0.8945790080738177 0.5038062283737024 0.39976931949250283 1 0.8991926182237601 0.5144175317185697 0.4079200307574009 1 0.9038062283737024 0.5250288350634371 0.41607074202229904 1 0.9084198385236447 0.5356401384083043 0.424221453287197 1 0.913033448673587 0.5462514417531718 0.43237216455209526 1 0.9176470588235294 0.5568627450980391 0.44052287581699334 1 0.9222606689734717 0.5674740484429065 0.4486735870818915 1 0.926874279123414 0.5780853517877739 0.4568242983467896 1 0.9314878892733564 0.5886966551326411 0.4649750096116877 1 0.9361014994232987 0.5993079584775085 0.4731257208765858 1 0.940715109573241 0.6099192618223759 0.4812764321414839 1 0.9453287197231833 0.6205305651672431 0.48942714340638194 1 0.9499423298731257 0.6311418685121106 0.49757785467128013 1 0.954555940023068 0.641753171856978 0.5057285659361782 1 0.9575547866205306 0.6512110726643597 0.515109573241061 1 0.9589388696655133 0.659515570934256 0.5257208765859284 1 0.960322952710496 0.6678200692041522 0.5363321799307956 1 0.9617070357554787 0.6761245674740484 0.546943483275663 1 0.9630911188004614 0.6844290657439446 0.5575547866205304 1 0.9644752018454441 0.6927335640138407 0.5681660899653976 1 0.9658592848904268 0.701038062283737 0.5787773933102651 1 0.9672433679354094 0.7093425605536331 0.5893886966551325 1 0.9686274509803922 0.7176470588235293 0.5999999999999999 1 0.9700115340253749 0.7259515570934255 0.6106113033448672 1 0.9713956170703576 0.7342560553633217 0.6212226066897346 1 0.9727797001153403 0.7425605536332179 0.631833910034602 1 0.9741637831603229 0.7508650519031141 0.6424452133794694 1 0.9755478662053056 0.7591695501730102 0.6530565167243365 1 0.9769319492502884 0.7674740484429066 0.6636678200692041 1 0.9783160322952711 0.7757785467128027 0.6742791234140715 1 0.9797001153402538 0.7840830449826989 0.6848904267589389 1 0.9810841983852365 0.7923875432525951 0.6955017301038062 1 0.9824682814302191 0.8006920415224913 0.7061130334486736 1 0.9838523644752019 0.8089965397923875 0.7167243367935409 1 0.9852364475201846 0.8173010380622837 0.7273356401384083 1 0.9866205305651673 0.8256055363321797 0.7379469434832755 1 0.98800461361015 0.833910034602076 0.748558246828143 1 0.9893886966551326 0.8422145328719722 0.7591695501730104 1 0.9907727797001153 0.8505190311418684 0.7697808535178777 1 0.9921568627450981 0.8588235294117647 0.7803921568627451 1 0.9912341407151096 0.8631295655517108 0.7877739331026529 1 0.9903114186851212 0.867435601691657 0.7951557093425605 1 0.9893886966551326 0.8717416378316032 0.8025374855824683 1 0.9884659746251442 0.8760476739715493 0.809919261822376 1 0.9875432525951557 0.8803537101114955 0.8173010380622837 1 0.9866205305651673 0.8846597462514417 0.8246828143021915 1 0.9856978085351787 0.8889657823913879 0.8320645905420992 1 0.9847750865051903 0.8932718185313341 0.8394463667820069 1 0.9838523644752019 0.8975778546712803 0.8468281430219147 1 0.9829296424452134 0.9018838908112264 0.8542099192618224 1 0.982006920415225 0.9061899269511726 0.8615916955017301 1 0.9810841983852365 0.9104959630911187 0.8689734717416377 1 0.980161476355248 0.914801999231065 0.8763552479815455 1 0.9792387543252595 0.9191080353710112 0.8837370242214533 1 0.9783160322952711 0.9234140715109573 0.891118800461361 1 0.9773933102652826 0.9277201076509035 0.8985005767012687 1 0.9764705882352941 0.9320261437908497 0.9058823529411765 1 0.9755478662053056 0.9363321799307959 0.9132641291810842 1 0.9746251441753172 0.940638216070742 0.9206459054209919 1 0.9737024221453288 0.9449442522106881 0.9280276816608996 1 0.9727797001153402 0.9492502883506344 0.9354094579008074 1 0.9718569780853518 0.9535563244905806 0.9427912341407151 1 0.9709342560553633 0.9578623606305268 0.9501730103806229 1 0.9700115340253749 0.9621683967704728 0.9575547866205305 1 0.9690888119953864 0.9664744329104191 0.9649365628604383 1 0.9657054978854287 0.9672433679354094 0.9680891964628989 1 0.9598615916955018 0.9644752018454441 0.9670126874279124 1 0.9540176855055748 0.9617070357554787 0.9659361783929258 1 0.9481737793156478 0.9589388696655132 0.9648596693579392 1 0.942329873125721 0.956170703575548 0.9637831603229527 1 0.936485966935794 0.9534025374855825 0.9627066512879662 1 0.930642060745867 0.9506343713956171 0.9616301422529796 1 0.92479815455594 0.9478662053056517 0.960553633217993 1 0.9189542483660131 0.9450980392156864 0.9594771241830066 1 0.9131103421760862 0.9423298731257209 0.95840061514802 1 0.9072664359861592 0.9395617070357555 0.9573241061130334 1 0.9014225297962323 0.9367935409457901 0.956247597078047 1 0.8955786236063054 0.9340253748558247 0.9551710880430604 1 0.8897347174163783 0.9312572087658594 0.9540945790080738 1 0.8838908112264514 0.9284890426758939 0.9530180699730872 1 0.8780469050365245 0.9257208765859286 0.9519415609381008 1 0.8722029988465976 0.9229527104959632 0.9508650519031142 1 0.8663590926566707 0.9201845444059977 0.9497885428681276 1 0.8605151864667436 0.9174163783160324 0.9487120338331411 1 0.8546712802768167 0.914648212226067 0.9476355247981546 1 0.8488273740868899 0.9118800461361016 0.946559015763168 1 0.8429834678969628 0.9091118800461362 0.9454825067281815 1 0.8371395617070359 0.9063437139561707 0.9444059976931949 1 0.8312956555171089 0.9035755478662054 0.9433294886582084 1 0.825451749327182 0.90080738177624 0.9422529796232219 1 0.8196078431372551 0.8980392156862746 0.9411764705882353 1 0.8099192618223763 0.8931180315263362 0.93840830449827 1 0.8002306805074973 0.8881968473663977 0.9356401384083045 1 0.7905420991926184 0.8832756632064592 0.9328719723183392 1 0.7808535178777396 0.8783544790465208 0.9301038062283737 1 0.7711649365628607 0.8734332948865823 0.9273356401384084 1 0.7614763552479817 0.8685121107266438 0.924567474048443 1 0.7517877739331029 0.8635909265667053 0.9217993079584775 1 0.742099192618224 0.8586697424067669 0.9190311418685122 1 0.7324106113033451 0.8537485582468283 0.9162629757785468 1 0.7227220299884662 0.8488273740868898 0.9134948096885814 1 0.7130334486735876 0.8439061899269515 0.9107266435986161 1 0.7033448673587084 0.8389850057670128 0.9079584775086506 1 0.6936562860438296 0.8340638216070744 0.9051903114186852 1 0.6839677047289506 0.8291426374471359 0.9024221453287198 1 0.6742791234140717 0.8242214532871974 0.8996539792387545 1 0.6645905420991929 0.819300269127259 0.896885813148789 1 0.654901960784314 0.8143790849673205 0.8941176470588236 1 0.645213379469435 0.8094579008073819 0.8913494809688582 1 0.6355247981545562 0.8045367166474434 0.8885813148788928 1 0.6258362168396773 0.7996155324875049 0.8858131487889275 1 0.6161476355247983 0.7946943483275665 0.883044982698962 1 0.6064590542099195 0.789773164167628 0.8802768166089966 1 0.5967704728950406 0.7848519800076895 0.8775086505190313 1 0.5870818915801617 0.779930795847751 0.8747404844290658 1 0.5773933102652828 0.7750096116878126 0.8719723183391004 1 0.5664744329104193 0.7687043444828915 0.8685121107266437 1 0.5543252595155715 0.7610149942329878 0.8643598615916958 1 0.5421760861207231 0.7533256439830837 0.8602076124567475 1 0.530026912725875 0.7456362937331797 0.8560553633217994 1 0.5178777393310268 0.7379469434832758 0.8519031141868513 1 0.5057285659361787 0.7302575932333719 0.8477508650519032 1 0.4935793925413305 0.7225682429834681 0.8435986159169551 1 0.4814302191464823 0.7148788927335642 0.839446366782007 1 0.4692810457516342 0.7071895424836603 0.8352941176470589 1 0.45713187235678604 0.6995001922337564 0.8311418685121108 1 0.4449826989619379 0.6918108419838525 0.8269896193771626 1 0.43283352556708976 0.6841214917339487 0.8228373702422146 1 0.42068435217224165 0.6764321414840447 0.8186851211072664 1 0.4085351787773935 0.6687427912341408 0.8145328719723184 1 0.3963860053825453 0.6610534409842369 0.8103806228373702 1 0.38423683198769715 0.653364090734333 0.8062283737024222 1 0.37208765859284904 0.6456747404844292 0.8020761245674741 1 0.3599384851980012 0.6379853902345254 0.7979238754325261 1 0.34778931180315276 0.6302960399846214 0.7937716262975778 1 0.3356401384083046 0.6226066897347174 0.7896193771626298 1 0.3234909650134564 0.6149173394848135 0.7854671280276817 1 0.3113417916186083 0.6072279892349096 0.7813148788927335 1 0.29919261822376014 0.5995386389850057 0.7771626297577854 1 0.287043444828912 0.5918492887351019 0.7730103806228373 1 0.27489427143406386 0.584159938485198 0.7688581314878893 1 0.2627450980392157 0.5764705882352941 0.7647058823529411 1 0.2575163398692811 0.5695501730103806 0.7611687812379854 1 0.2522875816993464 0.5626297577854671 0.7576316801230295 1 0.24705882352941178 0.5557093425605536 0.7540945790080738 1 0.24183006535947713 0.5487889273356401 0.750557477893118 1 0.2366013071895425 0.5418685121107266 0.7470203767781622 1 0.23137254901960785 0.5349480968858131 0.7434832756632064 1 0.2261437908496732 0.5280276816608996 0.7399461745482506 1 0.22091503267973872 0.5211072664359864 0.736409073433295 1 0.21568627450980393 0.5141868512110727 0.7328719723183391 1 0.21045751633986928 0.5072664359861592 0.7293348712033833 1 0.20522875816993463 0.5003460207612457 0.7257977700884275 1 0.2 0.4934256055363322 0.7222606689734717 1 0.1947712418300654 0.4865051903114187 0.718723567858516 1 0.1895424836601307 0.47958477508650516 0.7151864667435601 1 0.1843137254901961 0.47266435986159167 0.7116493656286044 1 0.17908496732026147 0.46574394463667823 0.7081122645136486 1 0.17385620915032682 0.45882352941176474 0.7045751633986929 1 0.16862745098039217 0.4519031141868512 0.701038062283737 1 0.16339869281045752 0.4449826989619377 0.6975009611687812 1 0.15816993464052287 0.43806228373702427 0.6939638600538255 1 0.15294117647058825 0.4311418685121108 0.6904267589388697 1 0.1477124183006536 0.42422145328719724 0.6868896578239139 1 0.14248366013071895 0.41730103806228375 0.6833525567089581 1 0.13725490196078446 0.4103806228373704 0.6798154555940025 1 0.1320261437908497 0.40346020761245677 0.6762783544790466 1 0.12725874663590928 0.3958477508650519 0.6687427912341407 1 0.1229527104959631 0.3875432525951557 0.6572087658592849 1 0.11864667435601693 0.37923875432525955 0.6456747404844291 1 0.11434063821607075 0.37093425605536334 0.6341407151095733 1 0.11003460207612457 0.36262975778546713 0.6226066897347174 1 0.10572856593617841 0.3543252595155709 0.6110726643598616 1 0.10142252979623223 0.34602076124567477 0.5995386389850058 1 0.09711649365628605 0.33771626297577856 0.58800461361015 1 0.09281045751633987 0.3294117647058824 0.5764705882352942 1 0.0885044213763937 0.3211072664359862 0.5649365628604384 1 0.08419838523644753 0.31280276816609 0.5534025374855824 1 0.07989234909650135 0.3044982698961938 0.5418685121107266 1 0.07558631295655519 0.29619377162629756 0.5303344867358708 1 0.071280276816609 0.2878892733564014 0.518800461361015 1 0.06697424067666295 0.2795847750865054 0.5072664359861595 1 0.06266820453671666 0.27128027681660905 0.49573241061130335 1 0.05836216839677047 0.26297577854671284 0.48419838523644754 1 0.054056132256824305 0.2546712802768166 0.4726643598615917 1 0.049750096116878126 0.24636678200692042 0.4611303344867359 1 0.04544405997693196 0.23806228373702423 0.4495963091118801 1 0.04113802383698577 0.22975778546712802 0.4380622837370242 1 0.0368319876970396 0.22145328719723184 0.4265282583621684 1 0.032525951557093424 0.21314878892733566 0.4149942329873126 1 0.02821991541714726 0.20484429065743945 0.40346020761245677 1 0.02391387927720108 0.19653979238754324 0.3919261822376009 1 0.0196078431372549 0.18823529411764706 0.3803921568627451 1 h5utils-1.13.2/colormaps/autumn000066400000000000000000000002341436105706500164340ustar00rootroot00000000000000# red-yellow color map (based on Matlab colormap) 1.0000000e+00 0.0000000e+00 0.0000000e+00 1 1.0000000e+00 1.0000000e+00 0.0000000e+00 1 h5utils-1.13.2/colormaps/bluered000066400000000000000000000000711436105706500165440ustar00rootroot00000000000000# blue-white-red color map 0 0 1 1 1 1 1 0 1 0 0 1 h5utils-1.13.2/colormaps/bone000066400000000000000000000066151436105706500160570ustar00rootroot00000000000000# grayscale with tinge of blue color map (from Matlab) (blackish to whitish) 0.0000000e+00 0.0000000e+00 5.2083333e-03 1 1.3888889e-02 1.3888889e-02 2.4305556e-02 1 2.7777778e-02 2.7777778e-02 4.3402778e-02 1 4.1666667e-02 4.1666667e-02 6.2500000e-02 1 5.5555556e-02 5.5555556e-02 8.1597222e-02 1 6.9444444e-02 6.9444444e-02 1.0069444e-01 1 8.3333333e-02 8.3333333e-02 1.1979167e-01 1 9.7222222e-02 9.7222222e-02 1.3888889e-01 1 1.1111111e-01 1.1111111e-01 1.5798611e-01 1 1.2500000e-01 1.2500000e-01 1.7708333e-01 1 1.3888889e-01 1.3888889e-01 1.9618056e-01 1 1.5277778e-01 1.5277778e-01 2.1527778e-01 1 1.6666667e-01 1.6666667e-01 2.3437500e-01 1 1.8055556e-01 1.8055556e-01 2.5347222e-01 1 1.9444444e-01 1.9444444e-01 2.7256944e-01 1 2.0833333e-01 2.0833333e-01 2.9166667e-01 1 2.2222222e-01 2.2222222e-01 3.1076389e-01 1 2.3611111e-01 2.3611111e-01 3.2986111e-01 1 2.5000000e-01 2.5000000e-01 3.4895833e-01 1 2.6388889e-01 2.6388889e-01 3.6805556e-01 1 2.7777778e-01 2.7777778e-01 3.8715278e-01 1 2.9166667e-01 2.9166667e-01 4.0625000e-01 1 3.0555556e-01 3.0555556e-01 4.2534722e-01 1 3.1944444e-01 3.1944444e-01 4.4444444e-01 1 3.3333333e-01 3.3854167e-01 4.5833333e-01 1 3.4722222e-01 3.5763889e-01 4.7222222e-01 1 3.6111111e-01 3.7673611e-01 4.8611111e-01 1 3.7500000e-01 3.9583333e-01 5.0000000e-01 1 3.8888889e-01 4.1493056e-01 5.1388889e-01 1 4.0277778e-01 4.3402778e-01 5.2777778e-01 1 4.1666667e-01 4.5312500e-01 5.4166667e-01 1 4.3055556e-01 4.7222222e-01 5.5555556e-01 1 4.4444444e-01 4.9131944e-01 5.6944444e-01 1 4.5833333e-01 5.1041667e-01 5.8333333e-01 1 4.7222222e-01 5.2951389e-01 5.9722222e-01 1 4.8611111e-01 5.4861111e-01 6.1111111e-01 1 5.0000000e-01 5.6770833e-01 6.2500000e-01 1 5.1388889e-01 5.8680556e-01 6.3888889e-01 1 5.2777778e-01 6.0590278e-01 6.5277778e-01 1 5.4166667e-01 6.2500000e-01 6.6666667e-01 1 5.5555556e-01 6.4409722e-01 6.8055556e-01 1 5.6944444e-01 6.6319444e-01 6.9444444e-01 1 5.8333333e-01 6.8229167e-01 7.0833333e-01 1 5.9722222e-01 7.0138889e-01 7.2222222e-01 1 6.1111111e-01 7.2048611e-01 7.3611111e-01 1 6.2500000e-01 7.3958333e-01 7.5000000e-01 1 6.3888889e-01 7.5868056e-01 7.6388889e-01 1 6.5277778e-01 7.7777778e-01 7.7777778e-01 1 6.7447917e-01 7.9166667e-01 7.9166667e-01 1 6.9618056e-01 8.0555556e-01 8.0555556e-01 1 7.1788194e-01 8.1944444e-01 8.1944444e-01 1 7.3958333e-01 8.3333333e-01 8.3333333e-01 1 7.6128472e-01 8.4722222e-01 8.4722222e-01 1 7.8298611e-01 8.6111111e-01 8.6111111e-01 1 8.0468750e-01 8.7500000e-01 8.7500000e-01 1 8.2638889e-01 8.8888889e-01 8.8888889e-01 1 8.4809028e-01 9.0277778e-01 9.0277778e-01 1 8.6979167e-01 9.1666667e-01 9.1666667e-01 1 8.9149306e-01 9.3055556e-01 9.3055556e-01 1 9.1319444e-01 9.4444444e-01 9.4444444e-01 1 9.3489583e-01 9.5833333e-01 9.5833333e-01 1 9.5659722e-01 9.7222222e-01 9.7222222e-01 1 9.7829861e-01 9.8611111e-01 9.8611111e-01 1 1.0000000e+00 1.0000000e+00 1.0000000e+00 1 h5utils-1.13.2/colormaps/colorcube000066400000000000000000000065561436105706500171150ustar00rootroot00000000000000# enhanced color-cube color map (from Matlab) 3.3333333e-01 3.3333333e-01 0.0000000e+00 1 3.3333333e-01 6.6666667e-01 0.0000000e+00 1 3.3333333e-01 1.0000000e+00 0.0000000e+00 1 6.6666667e-01 3.3333333e-01 0.0000000e+00 1 6.6666667e-01 6.6666667e-01 0.0000000e+00 1 6.6666667e-01 1.0000000e+00 0.0000000e+00 1 1.0000000e+00 3.3333333e-01 0.0000000e+00 1 1.0000000e+00 6.6666667e-01 0.0000000e+00 1 1.0000000e+00 1.0000000e+00 0.0000000e+00 1 0.0000000e+00 3.3333333e-01 5.0000000e-01 1 0.0000000e+00 6.6666667e-01 5.0000000e-01 1 0.0000000e+00 1.0000000e+00 5.0000000e-01 1 3.3333333e-01 0.0000000e+00 5.0000000e-01 1 3.3333333e-01 3.3333333e-01 5.0000000e-01 1 3.3333333e-01 6.6666667e-01 5.0000000e-01 1 3.3333333e-01 1.0000000e+00 5.0000000e-01 1 6.6666667e-01 0.0000000e+00 5.0000000e-01 1 6.6666667e-01 3.3333333e-01 5.0000000e-01 1 6.6666667e-01 6.6666667e-01 5.0000000e-01 1 6.6666667e-01 1.0000000e+00 5.0000000e-01 1 1.0000000e+00 0.0000000e+00 5.0000000e-01 1 1.0000000e+00 3.3333333e-01 5.0000000e-01 1 1.0000000e+00 6.6666667e-01 5.0000000e-01 1 1.0000000e+00 1.0000000e+00 5.0000000e-01 1 0.0000000e+00 3.3333333e-01 1.0000000e+00 1 0.0000000e+00 6.6666667e-01 1.0000000e+00 1 0.0000000e+00 1.0000000e+00 1.0000000e+00 1 3.3333333e-01 0.0000000e+00 1.0000000e+00 1 3.3333333e-01 3.3333333e-01 1.0000000e+00 1 3.3333333e-01 6.6666667e-01 1.0000000e+00 1 3.3333333e-01 1.0000000e+00 1.0000000e+00 1 6.6666667e-01 0.0000000e+00 1.0000000e+00 1 6.6666667e-01 3.3333333e-01 1.0000000e+00 1 6.6666667e-01 6.6666667e-01 1.0000000e+00 1 6.6666667e-01 1.0000000e+00 1.0000000e+00 1 1.0000000e+00 0.0000000e+00 1.0000000e+00 1 1.0000000e+00 3.3333333e-01 1.0000000e+00 1 1.0000000e+00 6.6666667e-01 1.0000000e+00 1 1.6666667e-01 0.0000000e+00 0.0000000e+00 1 3.3333333e-01 0.0000000e+00 0.0000000e+00 1 5.0000000e-01 0.0000000e+00 0.0000000e+00 1 6.6666667e-01 0.0000000e+00 0.0000000e+00 1 8.3333333e-01 0.0000000e+00 0.0000000e+00 1 1.0000000e+00 0.0000000e+00 0.0000000e+00 1 0.0000000e+00 1.6666667e-01 0.0000000e+00 1 0.0000000e+00 3.3333333e-01 0.0000000e+00 1 0.0000000e+00 5.0000000e-01 0.0000000e+00 1 0.0000000e+00 6.6666667e-01 0.0000000e+00 1 0.0000000e+00 8.3333333e-01 0.0000000e+00 1 0.0000000e+00 1.0000000e+00 0.0000000e+00 1 0.0000000e+00 0.0000000e+00 1.6666667e-01 1 0.0000000e+00 0.0000000e+00 3.3333333e-01 1 0.0000000e+00 0.0000000e+00 5.0000000e-01 1 0.0000000e+00 0.0000000e+00 6.6666667e-01 1 0.0000000e+00 0.0000000e+00 8.3333333e-01 1 0.0000000e+00 0.0000000e+00 1.0000000e+00 1 0.0000000e+00 0.0000000e+00 0.0000000e+00 1 1.4285714e-01 1.4285714e-01 1.4285714e-01 1 2.8571429e-01 2.8571429e-01 2.8571429e-01 1 4.2857143e-01 4.2857143e-01 4.2857143e-01 1 5.7142857e-01 5.7142857e-01 5.7142857e-01 1 7.1428571e-01 7.1428571e-01 7.1428571e-01 1 8.5714286e-01 8.5714286e-01 8.5714286e-01 1 1.0000000e+00 1.0000000e+00 1.0000000e+00 1 h5utils-1.13.2/colormaps/cool000066400000000000000000000002361436105706500160610ustar00rootroot00000000000000# cyan-magenta color map (based on Matlab colormap) 0.0000000e+00 1.0000000e+00 1.0000000e+00 1 1.0000000e+00 0.0000000e+00 1.0000000e+00 1 h5utils-1.13.2/colormaps/copper000066400000000000000000000065771436105706500164330ustar00rootroot00000000000000# linear copper-tone color map (from Matlab) (black to copper) 0.0000000e+00 0.0000000e+00 0.0000000e+00 1 1.9841270e-02 1.2400000e-02 7.8968254e-03 1 3.9682540e-02 2.4800000e-02 1.5793651e-02 1 5.9523810e-02 3.7200000e-02 2.3690476e-02 1 7.9365079e-02 4.9600000e-02 3.1587302e-02 1 9.9206349e-02 6.2000000e-02 3.9484127e-02 1 1.1904762e-01 7.4400000e-02 4.7380952e-02 1 1.3888889e-01 8.6800000e-02 5.5277778e-02 1 1.5873016e-01 9.9200000e-02 6.3174603e-02 1 1.7857143e-01 1.1160000e-01 7.1071429e-02 1 1.9841270e-01 1.2400000e-01 7.8968254e-02 1 2.1825397e-01 1.3640000e-01 8.6865079e-02 1 2.3809524e-01 1.4880000e-01 9.4761905e-02 1 2.5793651e-01 1.6120000e-01 1.0265873e-01 1 2.7777778e-01 1.7360000e-01 1.1055556e-01 1 2.9761905e-01 1.8600000e-01 1.1845238e-01 1 3.1746032e-01 1.9840000e-01 1.2634921e-01 1 3.3730159e-01 2.1080000e-01 1.3424603e-01 1 3.5714286e-01 2.2320000e-01 1.4214286e-01 1 3.7698413e-01 2.3560000e-01 1.5003968e-01 1 3.9682540e-01 2.4800000e-01 1.5793651e-01 1 4.1666667e-01 2.6040000e-01 1.6583333e-01 1 4.3650794e-01 2.7280000e-01 1.7373016e-01 1 4.5634921e-01 2.8520000e-01 1.8162698e-01 1 4.7619048e-01 2.9760000e-01 1.8952381e-01 1 4.9603175e-01 3.1000000e-01 1.9742063e-01 1 5.1587302e-01 3.2240000e-01 2.0531746e-01 1 5.3571429e-01 3.3480000e-01 2.1321429e-01 1 5.5555556e-01 3.4720000e-01 2.2111111e-01 1 5.7539683e-01 3.5960000e-01 2.2900794e-01 1 5.9523810e-01 3.7200000e-01 2.3690476e-01 1 6.1507937e-01 3.8440000e-01 2.4480159e-01 1 6.3492063e-01 3.9680000e-01 2.5269841e-01 1 6.5476190e-01 4.0920000e-01 2.6059524e-01 1 6.7460317e-01 4.2160000e-01 2.6849206e-01 1 6.9444444e-01 4.3400000e-01 2.7638889e-01 1 7.1428571e-01 4.4640000e-01 2.8428571e-01 1 7.3412698e-01 4.5880000e-01 2.9218254e-01 1 7.5396825e-01 4.7120000e-01 3.0007937e-01 1 7.7380952e-01 4.8360000e-01 3.0797619e-01 1 7.9365079e-01 4.9600000e-01 3.1587302e-01 1 8.1349206e-01 5.0840000e-01 3.2376984e-01 1 8.3333333e-01 5.2080000e-01 3.3166667e-01 1 8.5317460e-01 5.3320000e-01 3.3956349e-01 1 8.7301587e-01 5.4560000e-01 3.4746032e-01 1 8.9285714e-01 5.5800000e-01 3.5535714e-01 1 9.1269841e-01 5.7040000e-01 3.6325397e-01 1 9.3253968e-01 5.8280000e-01 3.7115079e-01 1 9.5238095e-01 5.9520000e-01 3.7904762e-01 1 9.7222222e-01 6.0760000e-01 3.8694444e-01 1 9.9206349e-01 6.2000000e-01 3.9484127e-01 1 1.0000000e+00 6.3240000e-01 4.0273810e-01 1 1.0000000e+00 6.4480000e-01 4.1063492e-01 1 1.0000000e+00 6.5720000e-01 4.1853175e-01 1 1.0000000e+00 6.6960000e-01 4.2642857e-01 1 1.0000000e+00 6.8200000e-01 4.3432540e-01 1 1.0000000e+00 6.9440000e-01 4.4222222e-01 1 1.0000000e+00 7.0680000e-01 4.5011905e-01 1 1.0000000e+00 7.1920000e-01 4.5801587e-01 1 1.0000000e+00 7.3160000e-01 4.6591270e-01 1 1.0000000e+00 7.4400000e-01 4.7380952e-01 1 1.0000000e+00 7.5640000e-01 4.8170635e-01 1 1.0000000e+00 7.6880000e-01 4.8960317e-01 1 1.0000000e+00 7.8120000e-01 4.9750000e-01 1 h5utils-1.13.2/colormaps/dkbluered000066400000000000000000000013711436105706500170670ustar00rootroot00000000000000# darkblue-blue-white-red-darkred color map, based loosely on "Seismic" # color table from Spyglass Transform 0.03 0.00 0.20 1 0.07 0.00 0.31 1 0.10 0.00 0.42 1 0.11 0.00 0.53 1 0.10 0.00 0.64 1 0.09 0.00 0.75 1 0.06 0.00 0.86 1 0.01 0.00 0.97 1 0.08 0.13 1.00 1 0.22 0.30 1.00 1 0.35 0.46 1.00 1 0.48 0.60 1.00 1 0.61 0.73 1.00 1 0.75 0.83 1.00 1 0.88 0.93 1.00 1 1.00 1.00 1.00 1 1.00 0.93 0.88 1 1.00 0.83 0.75 1 1.00 0.73 0.61 1 1.00 0.60 0.48 1 1.00 0.46 0.35 1 1.00 0.30 0.22 1 1.00 0.13 0.08 1 0.97 0.00 0.01 1 0.86 0.00 0.06 1 0.75 0.00 0.09 1 0.64 0.00 0.10 1 0.53 0.00 0.11 1 0.42 0.00 0.10 1 0.31 0.00 0.07 1 0.21 0.00 0.03 1 h5utils-1.13.2/colormaps/flag000066400000000000000000000066021436105706500160410ustar00rootroot00000000000000# alternating red, white, blue, and black color map (from Matlab) 1.0000000e+00 0.0000000e+00 0.0000000e+00 1 1.0000000e+00 1.0000000e+00 1.0000000e+00 1 0.0000000e+00 0.0000000e+00 1.0000000e+00 1 0.0000000e+00 0.0000000e+00 0.0000000e+00 1 1.0000000e+00 0.0000000e+00 0.0000000e+00 1 1.0000000e+00 1.0000000e+00 1.0000000e+00 1 0.0000000e+00 0.0000000e+00 1.0000000e+00 1 0.0000000e+00 0.0000000e+00 0.0000000e+00 1 1.0000000e+00 0.0000000e+00 0.0000000e+00 1 1.0000000e+00 1.0000000e+00 1.0000000e+00 1 0.0000000e+00 0.0000000e+00 1.0000000e+00 1 0.0000000e+00 0.0000000e+00 0.0000000e+00 1 1.0000000e+00 0.0000000e+00 0.0000000e+00 1 1.0000000e+00 1.0000000e+00 1.0000000e+00 1 0.0000000e+00 0.0000000e+00 1.0000000e+00 1 0.0000000e+00 0.0000000e+00 0.0000000e+00 1 1.0000000e+00 0.0000000e+00 0.0000000e+00 1 1.0000000e+00 1.0000000e+00 1.0000000e+00 1 0.0000000e+00 0.0000000e+00 1.0000000e+00 1 0.0000000e+00 0.0000000e+00 0.0000000e+00 1 1.0000000e+00 0.0000000e+00 0.0000000e+00 1 1.0000000e+00 1.0000000e+00 1.0000000e+00 1 0.0000000e+00 0.0000000e+00 1.0000000e+00 1 0.0000000e+00 0.0000000e+00 0.0000000e+00 1 1.0000000e+00 0.0000000e+00 0.0000000e+00 1 1.0000000e+00 1.0000000e+00 1.0000000e+00 1 0.0000000e+00 0.0000000e+00 1.0000000e+00 1 0.0000000e+00 0.0000000e+00 0.0000000e+00 1 1.0000000e+00 0.0000000e+00 0.0000000e+00 1 1.0000000e+00 1.0000000e+00 1.0000000e+00 1 0.0000000e+00 0.0000000e+00 1.0000000e+00 1 0.0000000e+00 0.0000000e+00 0.0000000e+00 1 1.0000000e+00 0.0000000e+00 0.0000000e+00 1 1.0000000e+00 1.0000000e+00 1.0000000e+00 1 0.0000000e+00 0.0000000e+00 1.0000000e+00 1 0.0000000e+00 0.0000000e+00 0.0000000e+00 1 1.0000000e+00 0.0000000e+00 0.0000000e+00 1 1.0000000e+00 1.0000000e+00 1.0000000e+00 1 0.0000000e+00 0.0000000e+00 1.0000000e+00 1 0.0000000e+00 0.0000000e+00 0.0000000e+00 1 1.0000000e+00 0.0000000e+00 0.0000000e+00 1 1.0000000e+00 1.0000000e+00 1.0000000e+00 1 0.0000000e+00 0.0000000e+00 1.0000000e+00 1 0.0000000e+00 0.0000000e+00 0.0000000e+00 1 1.0000000e+00 0.0000000e+00 0.0000000e+00 1 1.0000000e+00 1.0000000e+00 1.0000000e+00 1 0.0000000e+00 0.0000000e+00 1.0000000e+00 1 0.0000000e+00 0.0000000e+00 0.0000000e+00 1 1.0000000e+00 0.0000000e+00 0.0000000e+00 1 1.0000000e+00 1.0000000e+00 1.0000000e+00 1 0.0000000e+00 0.0000000e+00 1.0000000e+00 1 0.0000000e+00 0.0000000e+00 0.0000000e+00 1 1.0000000e+00 0.0000000e+00 0.0000000e+00 1 1.0000000e+00 1.0000000e+00 1.0000000e+00 1 0.0000000e+00 0.0000000e+00 1.0000000e+00 1 0.0000000e+00 0.0000000e+00 0.0000000e+00 1 1.0000000e+00 0.0000000e+00 0.0000000e+00 1 1.0000000e+00 1.0000000e+00 1.0000000e+00 1 0.0000000e+00 0.0000000e+00 1.0000000e+00 1 0.0000000e+00 0.0000000e+00 0.0000000e+00 1 1.0000000e+00 0.0000000e+00 0.0000000e+00 1 1.0000000e+00 1.0000000e+00 1.0000000e+00 1 0.0000000e+00 0.0000000e+00 1.0000000e+00 1 0.0000000e+00 0.0000000e+00 0.0000000e+00 1 h5utils-1.13.2/colormaps/gray000066400000000000000000000000731436105706500160660ustar00rootroot00000000000000# grayscale color map (white to black) 1 1 1 0 0 0 0 1 h5utils-1.13.2/colormaps/green000066400000000000000000000000671436105706500162270ustar00rootroot00000000000000# green color map (white to green) 1 1 1 0 0 1 0 1 h5utils-1.13.2/colormaps/hot000066400000000000000000000065611436105706500157260ustar00rootroot00000000000000# black-red-yellow-white color map (from Matlab) 4.1666667e-02 0.0000000e+00 0.0000000e+00 1 8.3333333e-02 0.0000000e+00 0.0000000e+00 1 1.2500000e-01 0.0000000e+00 0.0000000e+00 1 1.6666667e-01 0.0000000e+00 0.0000000e+00 1 2.0833333e-01 0.0000000e+00 0.0000000e+00 1 2.5000000e-01 0.0000000e+00 0.0000000e+00 1 2.9166667e-01 0.0000000e+00 0.0000000e+00 1 3.3333333e-01 0.0000000e+00 0.0000000e+00 1 3.7500000e-01 0.0000000e+00 0.0000000e+00 1 4.1666667e-01 0.0000000e+00 0.0000000e+00 1 4.5833333e-01 0.0000000e+00 0.0000000e+00 1 5.0000000e-01 0.0000000e+00 0.0000000e+00 1 5.4166667e-01 0.0000000e+00 0.0000000e+00 1 5.8333333e-01 0.0000000e+00 0.0000000e+00 1 6.2500000e-01 0.0000000e+00 0.0000000e+00 1 6.6666667e-01 0.0000000e+00 0.0000000e+00 1 7.0833333e-01 0.0000000e+00 0.0000000e+00 1 7.5000000e-01 0.0000000e+00 0.0000000e+00 1 7.9166667e-01 0.0000000e+00 0.0000000e+00 1 8.3333333e-01 0.0000000e+00 0.0000000e+00 1 8.7500000e-01 0.0000000e+00 0.0000000e+00 1 9.1666667e-01 0.0000000e+00 0.0000000e+00 1 9.5833333e-01 0.0000000e+00 0.0000000e+00 1 1.0000000e+00 0.0000000e+00 0.0000000e+00 1 1.0000000e+00 4.1666667e-02 0.0000000e+00 1 1.0000000e+00 8.3333333e-02 0.0000000e+00 1 1.0000000e+00 1.2500000e-01 0.0000000e+00 1 1.0000000e+00 1.6666667e-01 0.0000000e+00 1 1.0000000e+00 2.0833333e-01 0.0000000e+00 1 1.0000000e+00 2.5000000e-01 0.0000000e+00 1 1.0000000e+00 2.9166667e-01 0.0000000e+00 1 1.0000000e+00 3.3333333e-01 0.0000000e+00 1 1.0000000e+00 3.7500000e-01 0.0000000e+00 1 1.0000000e+00 4.1666667e-01 0.0000000e+00 1 1.0000000e+00 4.5833333e-01 0.0000000e+00 1 1.0000000e+00 5.0000000e-01 0.0000000e+00 1 1.0000000e+00 5.4166667e-01 0.0000000e+00 1 1.0000000e+00 5.8333333e-01 0.0000000e+00 1 1.0000000e+00 6.2500000e-01 0.0000000e+00 1 1.0000000e+00 6.6666667e-01 0.0000000e+00 1 1.0000000e+00 7.0833333e-01 0.0000000e+00 1 1.0000000e+00 7.5000000e-01 0.0000000e+00 1 1.0000000e+00 7.9166667e-01 0.0000000e+00 1 1.0000000e+00 8.3333333e-01 0.0000000e+00 1 1.0000000e+00 8.7500000e-01 0.0000000e+00 1 1.0000000e+00 9.1666667e-01 0.0000000e+00 1 1.0000000e+00 9.5833333e-01 0.0000000e+00 1 1.0000000e+00 1.0000000e+00 0.0000000e+00 1 1.0000000e+00 1.0000000e+00 6.2500000e-02 1 1.0000000e+00 1.0000000e+00 1.2500000e-01 1 1.0000000e+00 1.0000000e+00 1.8750000e-01 1 1.0000000e+00 1.0000000e+00 2.5000000e-01 1 1.0000000e+00 1.0000000e+00 3.1250000e-01 1 1.0000000e+00 1.0000000e+00 3.7500000e-01 1 1.0000000e+00 1.0000000e+00 4.3750000e-01 1 1.0000000e+00 1.0000000e+00 5.0000000e-01 1 1.0000000e+00 1.0000000e+00 5.6250000e-01 1 1.0000000e+00 1.0000000e+00 6.2500000e-01 1 1.0000000e+00 1.0000000e+00 6.8750000e-01 1 1.0000000e+00 1.0000000e+00 7.5000000e-01 1 1.0000000e+00 1.0000000e+00 8.1250000e-01 1 1.0000000e+00 1.0000000e+00 8.7500000e-01 1 1.0000000e+00 1.0000000e+00 9.3750000e-01 1 1.0000000e+00 1.0000000e+00 1.0000000e+00 1 h5utils-1.13.2/colormaps/hsv000066400000000000000000000066311436105706500157320ustar00rootroot00000000000000# hue-saturation-value color map (from Matlab) (red-yellow-green-cyan-blue-pink-magenta) 1.0000000e+00 0.0000000e+00 0.0000000e+00 1 1.0000000e+00 9.3750000e-02 0.0000000e+00 1 1.0000000e+00 1.8750000e-01 0.0000000e+00 1 1.0000000e+00 2.8125000e-01 0.0000000e+00 1 1.0000000e+00 3.7500000e-01 0.0000000e+00 1 1.0000000e+00 4.6875000e-01 0.0000000e+00 1 1.0000000e+00 5.6250000e-01 0.0000000e+00 1 1.0000000e+00 6.5625000e-01 0.0000000e+00 1 1.0000000e+00 7.5000000e-01 0.0000000e+00 1 1.0000000e+00 8.4375000e-01 0.0000000e+00 1 1.0000000e+00 9.3750000e-01 0.0000000e+00 1 9.6875000e-01 1.0000000e+00 0.0000000e+00 1 8.7500000e-01 1.0000000e+00 0.0000000e+00 1 7.8125000e-01 1.0000000e+00 0.0000000e+00 1 6.8750000e-01 1.0000000e+00 0.0000000e+00 1 5.9375000e-01 1.0000000e+00 0.0000000e+00 1 5.0000000e-01 1.0000000e+00 0.0000000e+00 1 4.0625000e-01 1.0000000e+00 0.0000000e+00 1 3.1250000e-01 1.0000000e+00 0.0000000e+00 1 2.1875000e-01 1.0000000e+00 0.0000000e+00 1 1.2500000e-01 1.0000000e+00 0.0000000e+00 1 3.1250000e-02 1.0000000e+00 0.0000000e+00 1 0.0000000e+00 1.0000000e+00 6.2500000e-02 1 0.0000000e+00 1.0000000e+00 1.5625000e-01 1 0.0000000e+00 1.0000000e+00 2.5000000e-01 1 0.0000000e+00 1.0000000e+00 3.4375000e-01 1 0.0000000e+00 1.0000000e+00 4.3750000e-01 1 0.0000000e+00 1.0000000e+00 5.3125000e-01 1 0.0000000e+00 1.0000000e+00 6.2500000e-01 1 0.0000000e+00 1.0000000e+00 7.1875000e-01 1 0.0000000e+00 1.0000000e+00 8.1250000e-01 1 0.0000000e+00 1.0000000e+00 9.0625000e-01 1 0.0000000e+00 1.0000000e+00 1.0000000e+00 1 0.0000000e+00 9.0625000e-01 1.0000000e+00 1 0.0000000e+00 8.1250000e-01 1.0000000e+00 1 0.0000000e+00 7.1875000e-01 1.0000000e+00 1 0.0000000e+00 6.2500000e-01 1.0000000e+00 1 0.0000000e+00 5.3125000e-01 1.0000000e+00 1 0.0000000e+00 4.3750000e-01 1.0000000e+00 1 0.0000000e+00 3.4375000e-01 1.0000000e+00 1 0.0000000e+00 2.5000000e-01 1.0000000e+00 1 0.0000000e+00 1.5625000e-01 1.0000000e+00 1 0.0000000e+00 6.2500000e-02 1.0000000e+00 1 3.1250000e-02 0.0000000e+00 1.0000000e+00 1 1.2500000e-01 0.0000000e+00 1.0000000e+00 1 2.1875000e-01 0.0000000e+00 1.0000000e+00 1 3.1250000e-01 0.0000000e+00 1.0000000e+00 1 4.0625000e-01 0.0000000e+00 1.0000000e+00 1 5.0000000e-01 0.0000000e+00 1.0000000e+00 1 5.9375000e-01 0.0000000e+00 1.0000000e+00 1 6.8750000e-01 0.0000000e+00 1.0000000e+00 1 7.8125000e-01 0.0000000e+00 1.0000000e+00 1 8.7500000e-01 0.0000000e+00 1.0000000e+00 1 9.6875000e-01 0.0000000e+00 1.0000000e+00 1 1.0000000e+00 0.0000000e+00 9.3750000e-01 1 1.0000000e+00 0.0000000e+00 8.4375000e-01 1 1.0000000e+00 0.0000000e+00 7.5000000e-01 1 1.0000000e+00 0.0000000e+00 6.5625000e-01 1 1.0000000e+00 0.0000000e+00 5.6250000e-01 1 1.0000000e+00 0.0000000e+00 4.6875000e-01 1 1.0000000e+00 0.0000000e+00 3.7500000e-01 1 1.0000000e+00 0.0000000e+00 2.8125000e-01 1 1.0000000e+00 0.0000000e+00 1.8750000e-01 1 1.0000000e+00 0.0000000e+00 9.3750000e-02 1 h5utils-1.13.2/colormaps/inferno000066400000000000000000000163651436105706500165770ustar00rootroot00000000000000# inferno colormap (based on Matplotlib colormap of the same name) 0.001462 466e-6 0.013866 1 0.002267 0.00127 0.01857 1 0.003299 0.002249 0.024239 1 0.004547 0.003392 0.030909 1 0.006006 0.004692 0.038558 1 0.007676 0.006136 0.046836 1 0.009561 0.007713 0.055143 1 0.011663 0.009417 0.06346 1 0.013995 0.011225 0.071862 1 0.016561 0.013136 0.080282 1 0.019373 0.015133 0.088767 1 0.022447 0.017199 0.097327 1 0.025793 0.019331 0.10593 1 0.029432 0.021503 0.114621 1 0.033385 0.023702 0.123397 1 0.037668 0.025921 0.132232 1 0.042253 0.028139 0.141141 1 0.046915 0.030324 0.150164 1 0.051644 0.032474 0.159254 1 0.056449 0.034569 0.168414 1 0.06134 0.03659 0.177642 1 0.066331 0.038504 0.186962 1 0.071429 0.040294 0.196354 1 0.076637 0.041905 0.205799 1 0.081962 0.043328 0.215289 1 0.087411 0.044556 0.224813 1 0.09299 0.045583 0.234358 1 0.098702 0.046402 0.243904 1 0.104551 0.047008 0.25343 1 0.110536 0.047399 0.262912 1 0.116656 0.047574 0.272321 1 0.122908 0.047536 0.281624 1 0.129285 0.047293 0.290788 1 0.135778 0.046856 0.299776 1 0.142378 0.046242 0.308553 1 0.149073 0.045468 0.317085 1 0.15585 0.044559 0.325338 1 0.162689 0.043554 0.333277 1 0.169575 0.042489 0.340874 1 0.176493 0.041402 0.348111 1 0.183429 0.040329 0.354971 1 0.190367 0.039309 0.361447 1 0.197297 0.0384 0.367535 1 0.204209 0.037632 0.373238 1 0.211095 0.03703 0.378563 1 0.217949 0.036615 0.383522 1 0.224763 0.036405 0.388129 1 0.231538 0.036405 0.3924 1 0.238273 0.036621 0.396353 1 0.244967 0.037055 0.400007 1 0.25162 0.037705 0.403378 1 0.258234 0.038571 0.406485 1 0.26481 0.039647 0.409345 1 0.271347 0.040922 0.411976 1 0.27785 0.042353 0.414392 1 0.284321 0.043933 0.416608 1 0.290763 0.045644 0.418637 1 0.297178 0.04747 0.420491 1 0.303568 0.049396 0.422182 1 0.309935 0.051407 0.423721 1 0.316282 0.05349 0.425116 1 0.32261 0.055634 0.426377 1 0.328921 0.057827 0.427511 1 0.335217 0.06006 0.428524 1 0.3415 0.062325 0.429425 1 0.347771 0.064616 0.430217 1 0.354032 0.066925 0.430906 1 0.360284 0.069247 0.431497 1 0.366529 0.071579 0.431994 1 0.372768 0.073915 0.4324 1 0.379001 0.076253 0.432719 1 0.385228 0.078591 0.432955 1 0.391453 0.080927 0.433109 1 0.397674 0.083257 0.433183 1 0.403894 0.08558 0.433179 1 0.410113 0.087896 0.433098 1 0.416331 0.090203 0.432943 1 0.422549 0.092501 0.432714 1 0.428768 0.09479 0.432412 1 0.434987 0.097069 0.432039 1 0.441207 0.099338 0.431594 1 0.447428 0.101597 0.43108 1 0.453651 0.103848 0.430498 1 0.459875 0.106089 0.429846 1 0.4661 0.108322 0.429125 1 0.472328 0.110547 0.428334 1 0.478558 0.112764 0.427475 1 0.484789 0.114974 0.426548 1 0.491022 0.117179 0.425552 1 0.497257 0.119379 0.424488 1 0.503493 0.121575 0.423356 1 0.50973 0.123769 0.422156 1 0.515967 0.12596 0.420887 1 0.522206 0.12815 0.419549 1 0.528444 0.130341 0.418142 1 0.534683 0.132534 0.416667 1 0.54092 0.134729 0.415123 1 0.547157 0.136929 0.413511 1 0.553392 0.139134 0.411829 1 0.559624 0.141346 0.410078 1 0.565854 0.143567 0.408258 1 0.572081 0.145797 0.406369 1 0.578304 0.148039 0.404411 1 0.584521 0.150294 0.402385 1 0.590734 0.152563 0.40029 1 0.59694 0.154848 0.398125 1 0.603139 0.157151 0.395891 1 0.60933 0.159474 0.393589 1 0.615513 0.161817 0.391219 1 0.621685 0.164184 0.388781 1 0.627847 0.166575 0.386276 1 0.633998 0.168992 0.383704 1 0.640135 0.171438 0.381065 1 0.64626 0.173914 0.378359 1 0.652369 0.176421 0.375586 1 0.658463 0.178962 0.372748 1 0.66454 0.181539 0.369846 1 0.670599 0.184153 0.366879 1 0.676638 0.186807 0.363849 1 0.682656 0.189501 0.360757 1 0.688653 0.192239 0.357603 1 0.694627 0.195021 0.354388 1 0.700576 0.197851 0.351113 1 0.7065 0.200728 0.347777 1 0.712396 0.203656 0.344383 1 0.718264 0.206636 0.340931 1 0.724103 0.20967 0.337424 1 0.729909 0.212759 0.333861 1 0.735683 0.215906 0.330245 1 0.741423 0.219112 0.326576 1 0.747127 0.222378 0.322856 1 0.752794 0.225706 0.319085 1 0.758422 0.229097 0.315266 1 0.76401 0.232554 0.311399 1 0.769556 0.236077 0.307485 1 0.775059 0.239667 0.303526 1 0.780517 0.243327 0.299523 1 0.785929 0.247056 0.295477 1 0.791293 0.250856 0.29139 1 0.796607 0.254728 0.287264 1 0.801871 0.258674 0.283099 1 0.807082 0.262692 0.278898 1 0.812239 0.266786 0.274661 1 0.817341 0.270954 0.27039 1 0.822386 0.275197 0.266085 1 0.827372 0.279517 0.26175 1 0.832299 0.283913 0.257383 1 0.837165 0.288385 0.252988 1 0.841969 0.292933 0.248564 1 0.846709 0.297559 0.244113 1 0.851384 0.30226 0.239636 1 0.855992 0.307038 0.235133 1 0.860533 0.311892 0.230606 1 0.865006 0.316822 0.226055 1 0.869409 0.321827 0.221482 1 0.873741 0.326906 0.216886 1 0.878001 0.33206 0.212268 1 0.882188 0.337287 0.207628 1 0.886302 0.342586 0.202968 1 0.890341 0.347957 0.198286 1 0.894305 0.353399 0.193584 1 0.898192 0.358911 0.18886 1 0.902003 0.364492 0.184116 1 0.905735 0.37014 0.17935 1 0.90939 0.375856 0.174563 1 0.912966 0.381636 0.169755 1 0.916462 0.387481 0.164924 1 0.919879 0.393389 0.16007 1 0.923215 0.399359 0.155193 1 0.92647 0.405389 0.150292 1 0.929644 0.411479 0.145367 1 0.932737 0.417627 0.140417 1 0.935747 0.423831 0.13544 1 0.938675 0.430091 0.130438 1 0.941521 0.436405 0.125409 1 0.944285 0.442772 0.120354 1 0.946965 0.449191 0.115272 1 0.949562 0.45566 0.110164 1 0.952075 0.462178 0.105031 1 0.954506 0.468744 0.099874 1 0.956852 0.475356 0.094695 1 0.959114 0.482014 0.089499 1 0.961293 0.488716 0.084289 1 0.963387 0.495462 0.079073 1 0.965397 0.502249 0.073859 1 0.967322 0.509078 0.068659 1 0.969163 0.515946 0.063488 1 0.970919 0.522853 0.058367 1 0.97259 0.529798 0.053324 1 0.974176 0.53678 0.048392 1 0.975677 0.543798 0.043618 1 0.977092 0.55085 0.03905 1 0.978422 0.557937 0.034931 1 0.979666 0.565057 0.031409 1 0.980824 0.572209 0.028508 1 0.981895 0.579392 0.02625 1 0.982881 0.586606 0.024661 1 0.983779 0.593849 0.02377 1 0.984591 0.601122 0.023606 1 0.985315 0.608422 0.024202 1 0.985952 0.61575 0.025592 1 0.986502 0.623105 0.027814 1 0.986964 0.630485 0.030908 1 0.987337 0.63789 0.034916 1 0.987622 0.64532 0.039886 1 0.987819 0.652773 0.045581 1 0.987926 0.66025 0.05175 1 0.987945 0.667748 0.058329 1 0.987874 0.675267 0.065257 1 0.987714 0.682807 0.072489 1 0.987464 0.690366 0.07999 1 0.987124 0.697944 0.087731 1 0.986694 0.70554 0.095694 1 0.986175 0.713153 0.103863 1 0.985566 0.720782 0.112229 1 0.984865 0.728427 0.120785 1 0.984075 0.736087 0.129527 1 0.983196 0.743758 0.138453 1 0.982228 0.751442 0.147565 1 0.981173 0.759135 0.156863 1 0.980032 0.766837 0.166353 1 0.978806 0.774545 0.176037 1 0.977497 0.782258 0.185923 1 0.976108 0.789974 0.196018 1 0.974638 0.797692 0.206332 1 0.973088 0.805409 0.216877 1 0.971468 0.813122 0.227658 1 0.969783 0.820825 0.238686 1 0.968041 0.828515 0.249972 1 0.966243 0.836191 0.261534 1 0.964394 0.843848 0.273391 1 0.962517 0.851476 0.285546 1 0.960626 0.859069 0.29801 1 0.95872 0.866624 0.31082 1 0.956834 0.874129 0.323974 1 0.954997 0.881569 0.337475 1 0.953215 0.888942 0.351369 1 0.951546 0.896226 0.365627 1 0.950018 0.903409 0.380271 1 0.948683 0.910473 0.395289 1 0.947594 0.917399 0.410665 1 0.946809 0.924168 0.426373 1 0.946392 0.930761 0.442367 1 0.946403 0.937159 0.458592 1 0.946903 0.943348 0.47497 1 0.947937 0.949318 0.491426 1 0.949545 0.955063 0.50786 1 0.95174 0.960587 0.524203 1 0.954529 0.965896 0.540361 1 0.957896 0.971003 0.556275 1 0.961812 0.975924 0.571925 1 0.966249 0.980678 0.587206 1 0.971162 0.985282 0.602154 1 0.976511 0.989753 0.61676 1 0.982257 0.994109 0.631017 1 0.988362 0.998364 0.644924 1 h5utils-1.13.2/colormaps/jet000066400000000000000000000016061436105706500157110ustar00rootroot00000000000000# variant of HSV (from Matlab) (blue-cyan-yellow-red) 0.0000000e+00 0.0000000e+00 7.5000000e-01 1 0.0000000e+00 0.0000000e+00 1.0000000e+00 1 0.0000000e+00 2.5000000e-01 1.0000000e+00 1 0.0000000e+00 5.0000000e-01 1.0000000e+00 1 0.0000000e+00 7.5000000e-01 1.0000000e+00 1 0.0000000e+00 1.0000000e+00 1.0000000e+00 1 2.5000000e-01 1.0000000e+00 1.0000000e+00 1 5.0000000e-01 1.0000000e+00 7.5000000e-01 1 7.5000000e-01 1.0000000e+00 5.0000000e-01 1 1.0000000e+00 1.0000000e+00 2.5000000e-01 1 1.0000000e+00 1.0000000e+00 0.0000000e+00 1 1.0000000e+00 7.5000000e-01 0.0000000e+00 1 1.0000000e+00 5.0000000e-01 0.0000000e+00 1 1.0000000e+00 2.5000000e-01 0.0000000e+00 1 1.0000000e+00 0.0000000e+00 0.0000000e+00 1 7.5000000e-01 0.0000000e+00 0.0000000e+00 1 h5utils-1.13.2/colormaps/lines000066400000000000000000000065421436105706500162450ustar00rootroot00000000000000# Color map of Matlab line colors 0.0000000e+00 0.0000000e+00 1.0000000e+00 1 0.0000000e+00 5.0000000e-01 0.0000000e+00 1 1.0000000e+00 0.0000000e+00 0.0000000e+00 1 0.0000000e+00 7.5000000e-01 7.5000000e-01 1 7.5000000e-01 0.0000000e+00 7.5000000e-01 1 7.5000000e-01 7.5000000e-01 0.0000000e+00 1 2.5000000e-01 2.5000000e-01 2.5000000e-01 1 0.0000000e+00 0.0000000e+00 1.0000000e+00 1 0.0000000e+00 5.0000000e-01 0.0000000e+00 1 1.0000000e+00 0.0000000e+00 0.0000000e+00 1 0.0000000e+00 7.5000000e-01 7.5000000e-01 1 7.5000000e-01 0.0000000e+00 7.5000000e-01 1 7.5000000e-01 7.5000000e-01 0.0000000e+00 1 2.5000000e-01 2.5000000e-01 2.5000000e-01 1 0.0000000e+00 0.0000000e+00 1.0000000e+00 1 0.0000000e+00 5.0000000e-01 0.0000000e+00 1 1.0000000e+00 0.0000000e+00 0.0000000e+00 1 0.0000000e+00 7.5000000e-01 7.5000000e-01 1 7.5000000e-01 0.0000000e+00 7.5000000e-01 1 7.5000000e-01 7.5000000e-01 0.0000000e+00 1 2.5000000e-01 2.5000000e-01 2.5000000e-01 1 0.0000000e+00 0.0000000e+00 1.0000000e+00 1 0.0000000e+00 5.0000000e-01 0.0000000e+00 1 1.0000000e+00 0.0000000e+00 0.0000000e+00 1 0.0000000e+00 7.5000000e-01 7.5000000e-01 1 7.5000000e-01 0.0000000e+00 7.5000000e-01 1 7.5000000e-01 7.5000000e-01 0.0000000e+00 1 2.5000000e-01 2.5000000e-01 2.5000000e-01 1 0.0000000e+00 0.0000000e+00 1.0000000e+00 1 0.0000000e+00 5.0000000e-01 0.0000000e+00 1 1.0000000e+00 0.0000000e+00 0.0000000e+00 1 0.0000000e+00 7.5000000e-01 7.5000000e-01 1 7.5000000e-01 0.0000000e+00 7.5000000e-01 1 7.5000000e-01 7.5000000e-01 0.0000000e+00 1 2.5000000e-01 2.5000000e-01 2.5000000e-01 1 0.0000000e+00 0.0000000e+00 1.0000000e+00 1 0.0000000e+00 5.0000000e-01 0.0000000e+00 1 1.0000000e+00 0.0000000e+00 0.0000000e+00 1 0.0000000e+00 7.5000000e-01 7.5000000e-01 1 7.5000000e-01 0.0000000e+00 7.5000000e-01 1 7.5000000e-01 7.5000000e-01 0.0000000e+00 1 2.5000000e-01 2.5000000e-01 2.5000000e-01 1 0.0000000e+00 0.0000000e+00 1.0000000e+00 1 0.0000000e+00 5.0000000e-01 0.0000000e+00 1 1.0000000e+00 0.0000000e+00 0.0000000e+00 1 0.0000000e+00 7.5000000e-01 7.5000000e-01 1 7.5000000e-01 0.0000000e+00 7.5000000e-01 1 7.5000000e-01 7.5000000e-01 0.0000000e+00 1 2.5000000e-01 2.5000000e-01 2.5000000e-01 1 0.0000000e+00 0.0000000e+00 1.0000000e+00 1 0.0000000e+00 5.0000000e-01 0.0000000e+00 1 1.0000000e+00 0.0000000e+00 0.0000000e+00 1 0.0000000e+00 7.5000000e-01 7.5000000e-01 1 7.5000000e-01 0.0000000e+00 7.5000000e-01 1 7.5000000e-01 7.5000000e-01 0.0000000e+00 1 2.5000000e-01 2.5000000e-01 2.5000000e-01 1 0.0000000e+00 0.0000000e+00 1.0000000e+00 1 0.0000000e+00 5.0000000e-01 0.0000000e+00 1 1.0000000e+00 0.0000000e+00 0.0000000e+00 1 0.0000000e+00 7.5000000e-01 7.5000000e-01 1 7.5000000e-01 0.0000000e+00 7.5000000e-01 1 7.5000000e-01 7.5000000e-01 0.0000000e+00 1 2.5000000e-01 2.5000000e-01 2.5000000e-01 1 0.0000000e+00 0.0000000e+00 1.0000000e+00 1 h5utils-1.13.2/colormaps/pink000066400000000000000000000066031436105706500160720ustar00rootroot00000000000000# pastel shades of pink color map (from Matlab) (black-pink-white) 1.1785113e-01 0.0000000e+00 0.0000000e+00 1 1.9585655e-01 1.0286890e-01 1.0286890e-01 1 2.5066050e-01 1.4547859e-01 1.4547859e-01 1 2.9546842e-01 1.7817416e-01 1.7817416e-01 1 3.3432392e-01 2.0573780e-01 2.0573780e-01 1 3.6911162e-01 2.3002185e-01 2.3002185e-01 1 4.0089186e-01 2.5197632e-01 2.5197632e-01 1 4.3033148e-01 2.7216553e-01 2.7216553e-01 1 4.5788217e-01 2.9095719e-01 2.9095719e-01 1 4.8386670e-01 3.0860670e-01 3.0860670e-01 1 5.0852520e-01 3.2530002e-01 3.2530002e-01 1 5.3204209e-01 3.4117754e-01 3.4117754e-01 1 5.5456260e-01 3.5634832e-01 3.5634832e-01 1 5.7620359e-01 3.7089909e-01 3.7089909e-01 1 5.9706070e-01 3.8490018e-01 3.8490018e-01 1 6.1721340e-01 3.9840954e-01 3.9840954e-01 1 6.3672858e-01 4.1147560e-01 4.1147560e-01 1 6.5566316e-01 4.2413934e-01 4.2413934e-01 1 6.7406608e-01 4.3643578e-01 4.3643578e-01 1 6.9197975e-01 4.4839514e-01 4.4839514e-01 1 7.0944124e-01 4.6004371e-01 4.6004371e-01 1 7.2648316e-01 4.7140452e-01 4.7140452e-01 1 7.4313436e-01 4.8249791e-01 4.8249791e-01 1 7.5942055e-01 4.9334191e-01 4.9334191e-01 1 7.6635604e-01 5.1754917e-01 5.0395263e-01 1 7.7322933e-01 5.4067369e-01 5.1434450e-01 1 7.8004206e-01 5.6284895e-01 5.2453053e-01 1 7.8679579e-01 5.8418305e-01 5.3452248e-01 1 7.9349205e-01 6.0476503e-01 5.4433105e-01 1 8.0013226e-01 6.2466922e-01 5.5396598e-01 1 8.0671783e-01 6.4395849e-01 5.6343617e-01 1 8.1325006e-01 6.6268653e-01 5.7274980e-01 1 8.1973024e-01 6.8089965e-01 5.8191437e-01 1 8.2615960e-01 6.9863813e-01 5.9093684e-01 1 8.3253930e-01 7.1593724e-01 5.9982361e-01 1 8.3887049e-01 7.3282811e-01 6.0858062e-01 1 8.4515425e-01 7.4933833e-01 6.1721340e-01 1 8.5139164e-01 7.6549254e-01 6.2572709e-01 1 8.5758366e-01 7.8131283e-01 6.3412649e-01 1 8.6373129e-01 7.9681907e-01 6.4241607e-01 1 8.6983548e-01 8.1202927e-01 6.5060005e-01 1 8.7589712e-01 8.2695975e-01 6.5868235e-01 1 8.8191710e-01 8.4162541e-01 6.6666667e-01 1 8.8789627e-01 8.5603985e-01 6.7455649e-01 1 8.9383544e-01 8.7021557e-01 6.8235509e-01 1 8.9973541e-01 8.8416403e-01 6.9006556e-01 1 9.0559694e-01 8.9789584e-01 6.9769082e-01 1 9.1142078e-01 9.1142078e-01 7.0523365e-01 1 9.1720763e-01 9.1720763e-01 7.2716562e-01 1 9.2295821e-01 9.2295821e-01 7.4845520e-01 1 9.2867317e-01 9.2867317e-01 7.6915572e-01 1 9.3435318e-01 9.3435318e-01 7.8931355e-01 1 9.3999887e-01 9.3999887e-01 8.0896923e-01 1 9.4561086e-01 9.4561086e-01 8.2815854e-01 1 9.5118973e-01 9.5118973e-01 8.4691316e-01 1 9.5673607e-01 9.5673607e-01 8.6526138e-01 1 9.6225045e-01 9.6225045e-01 8.8322851e-01 1 9.6773340e-01 9.6773340e-01 9.0083735e-01 1 9.7318546e-01 9.7318546e-01 9.1810853e-01 1 9.7860715e-01 9.7860715e-01 9.3506076e-01 1 9.8399897e-01 9.8399897e-01 9.5171107e-01 1 9.8936140e-01 9.8936140e-01 9.6807506e-01 1 9.9469492e-01 9.9469492e-01 9.8416699e-01 1 1.0000000e+00 1.0000000e+00 1.0000000e+00 1 h5utils-1.13.2/colormaps/prism000066400000000000000000000016361436105706500162640ustar00rootroot00000000000000# prism color map (from Matlab) (red-yellow-green-blue-purple--green) 1.0000000e+00 0.0000000e+00 0.0000000e+00 1 1.0000000e+00 5.0000000e-01 0.0000000e+00 1 1.0000000e+00 1.0000000e+00 0.0000000e+00 1 0.0000000e+00 1.0000000e+00 0.0000000e+00 1 0.0000000e+00 0.0000000e+00 1.0000000e+00 1 6.6666667e-01 0.0000000e+00 1.0000000e+00 1 1.0000000e+00 0.0000000e+00 0.0000000e+00 1 1.0000000e+00 5.0000000e-01 0.0000000e+00 1 1.0000000e+00 1.0000000e+00 0.0000000e+00 1 0.0000000e+00 1.0000000e+00 0.0000000e+00 1 0.0000000e+00 0.0000000e+00 1.0000000e+00 1 6.6666667e-01 0.0000000e+00 1.0000000e+00 1 1.0000000e+00 0.0000000e+00 0.0000000e+00 1 1.0000000e+00 5.0000000e-01 0.0000000e+00 1 1.0000000e+00 1.0000000e+00 0.0000000e+00 1 0.0000000e+00 1.0000000e+00 0.0000000e+00 1 h5utils-1.13.2/colormaps/spring000066400000000000000000000015711436105706500164320ustar00rootroot00000000000000# magenta-yellow color map (from Matlab) 1.0000000e+00 0.0000000e+00 1.0000000e+00 1 1.0000000e+00 6.6666667e-02 9.3333333e-01 1 1.0000000e+00 1.3333333e-01 8.6666667e-01 1 1.0000000e+00 2.0000000e-01 8.0000000e-01 1 1.0000000e+00 2.6666667e-01 7.3333333e-01 1 1.0000000e+00 3.3333333e-01 6.6666667e-01 1 1.0000000e+00 4.0000000e-01 6.0000000e-01 1 1.0000000e+00 4.6666667e-01 5.3333333e-01 1 1.0000000e+00 5.3333333e-01 4.6666667e-01 1 1.0000000e+00 6.0000000e-01 4.0000000e-01 1 1.0000000e+00 6.6666667e-01 3.3333333e-01 1 1.0000000e+00 7.3333333e-01 2.6666667e-01 1 1.0000000e+00 8.0000000e-01 2.0000000e-01 1 1.0000000e+00 8.6666667e-01 1.3333333e-01 1 1.0000000e+00 9.3333333e-01 6.6666667e-02 1 1.0000000e+00 1.0000000e+00 0.0000000e+00 1 h5utils-1.13.2/colormaps/summer000066400000000000000000000015671436105706500164450ustar00rootroot00000000000000# green-yellow color map (from Matlab) 0.0000000e+00 5.0000000e-01 4.0000000e-01 1 6.6666667e-02 5.3333333e-01 4.0000000e-01 1 1.3333333e-01 5.6666667e-01 4.0000000e-01 1 2.0000000e-01 6.0000000e-01 4.0000000e-01 1 2.6666667e-01 6.3333333e-01 4.0000000e-01 1 3.3333333e-01 6.6666667e-01 4.0000000e-01 1 4.0000000e-01 7.0000000e-01 4.0000000e-01 1 4.6666667e-01 7.3333333e-01 4.0000000e-01 1 5.3333333e-01 7.6666667e-01 4.0000000e-01 1 6.0000000e-01 8.0000000e-01 4.0000000e-01 1 6.6666667e-01 8.3333333e-01 4.0000000e-01 1 7.3333333e-01 8.6666667e-01 4.0000000e-01 1 8.0000000e-01 9.0000000e-01 4.0000000e-01 1 8.6666667e-01 9.3333333e-01 4.0000000e-01 1 9.3333333e-01 9.6666667e-01 4.0000000e-01 1 1.0000000e+00 1.0000000e+00 4.0000000e-01 1 h5utils-1.13.2/colormaps/vga000066400000000000000000000015671436105706500157120ustar00rootroot00000000000000# Windows 4-bit colormap (from Matlab) 1.0000000e+00 1.0000000e+00 1.0000000e+00 1 7.5000000e-01 7.5000000e-01 7.5000000e-01 1 1.0000000e+00 0.0000000e+00 0.0000000e+00 1 1.0000000e+00 1.0000000e+00 0.0000000e+00 1 0.0000000e+00 1.0000000e+00 0.0000000e+00 1 0.0000000e+00 1.0000000e+00 1.0000000e+00 1 0.0000000e+00 0.0000000e+00 1.0000000e+00 1 1.0000000e+00 0.0000000e+00 1.0000000e+00 1 0.0000000e+00 0.0000000e+00 0.0000000e+00 1 5.0000000e-01 5.0000000e-01 5.0000000e-01 1 5.0000000e-01 0.0000000e+00 0.0000000e+00 1 5.0000000e-01 5.0000000e-01 0.0000000e+00 1 0.0000000e+00 5.0000000e-01 0.0000000e+00 1 0.0000000e+00 5.0000000e-01 5.0000000e-01 1 0.0000000e+00 0.0000000e+00 5.0000000e-01 1 5.0000000e-01 0.0000000e+00 5.0000000e-01 1 h5utils-1.13.2/colormaps/viridis000066400000000000000000000163641436105706500166070ustar00rootroot00000000000000# viridis colormap (based on Matplotlib colormap of the same name) 0.267004 0.004874 0.329415 1 0.26851 0.009605 0.335427 1 0.269944 0.014625 0.341379 1 0.271305 0.019942 0.347269 1 0.272594 0.025563 0.353093 1 0.273809 0.031497 0.358853 1 0.274952 0.037752 0.364543 1 0.276022 0.044167 0.370164 1 0.277018 0.050344 0.375715 1 0.277941 0.056324 0.381191 1 0.278791 0.062145 0.386592 1 0.279566 0.067836 0.391917 1 0.280267 0.073417 0.397163 1 0.280894 0.078907 0.402329 1 0.281446 0.08432 0.407414 1 0.281924 0.089666 0.412415 1 0.282327 0.094955 0.417331 1 0.282656 0.100196 0.42216 1 0.28291 0.105393 0.426902 1 0.283091 0.110553 0.431554 1 0.283197 0.11568 0.436115 1 0.283229 0.120777 0.440584 1 0.283187 0.125848 0.44496 1 0.283072 0.130895 0.449241 1 0.282884 0.13592 0.453427 1 0.282623 0.140926 0.457517 1 0.28229 0.145912 0.46151 1 0.281887 0.150881 0.465405 1 0.281412 0.155834 0.469201 1 0.280868 0.160771 0.472899 1 0.280255 0.165693 0.476498 1 0.279574 0.170599 0.479997 1 0.278826 0.17549 0.483397 1 0.278012 0.180367 0.486697 1 0.277134 0.185228 0.489898 1 0.276194 0.190074 0.493001 1 0.275191 0.194905 0.496005 1 0.274128 0.199721 0.498911 1 0.273006 0.20452 0.501721 1 0.271828 0.209303 0.504434 1 0.270595 0.214069 0.507052 1 0.269308 0.218818 0.509577 1 0.267968 0.223549 0.512008 1 0.26658 0.228262 0.514349 1 0.265145 0.232956 0.516599 1 0.263663 0.237631 0.518762 1 0.262138 0.242286 0.520837 1 0.260571 0.246922 0.522828 1 0.258965 0.251537 0.524736 1 0.257322 0.25613 0.526563 1 0.255645 0.260703 0.528312 1 0.253935 0.265254 0.529983 1 0.252194 0.269783 0.531579 1 0.250425 0.27429 0.533103 1 0.248629 0.278775 0.534556 1 0.246811 0.283237 0.535941 1 0.244972 0.287675 0.53726 1 0.243113 0.292092 0.538516 1 0.241237 0.296485 0.539709 1 0.239346 0.300855 0.540844 1 0.237441 0.305202 0.541921 1 0.235526 0.309527 0.542944 1 0.233603 0.313828 0.543914 1 0.231674 0.318106 0.544834 1 0.229739 0.322361 0.545706 1 0.227802 0.326594 0.546532 1 0.225863 0.330805 0.547314 1 0.223925 0.334994 0.548053 1 0.221989 0.339161 0.548752 1 0.220057 0.343307 0.549413 1 0.21813 0.347432 0.550038 1 0.21621 0.351535 0.550627 1 0.214298 0.355619 0.551184 1 0.212395 0.359683 0.55171 1 0.210503 0.363727 0.552206 1 0.208623 0.367752 0.552675 1 0.206756 0.371758 0.553117 1 0.204903 0.375746 0.553533 1 0.203063 0.379716 0.553925 1 0.201239 0.38367 0.554294 1 0.19943 0.387607 0.554642 1 0.197636 0.391528 0.554969 1 0.19586 0.395433 0.555276 1 0.1941 0.399323 0.555565 1 0.192357 0.403199 0.555836 1 0.190631 0.407061 0.556089 1 0.188923 0.41091 0.556326 1 0.187231 0.414746 0.556547 1 0.185556 0.41857 0.556753 1 0.183898 0.422383 0.556944 1 0.182256 0.426184 0.55712 1 0.180629 0.429975 0.557282 1 0.179019 0.433756 0.55743 1 0.177423 0.437527 0.557565 1 0.175841 0.44129 0.557685 1 0.174274 0.445044 0.557792 1 0.172719 0.448791 0.557885 1 0.171176 0.45253 0.557965 1 0.169646 0.456262 0.55803 1 0.168126 0.459988 0.558082 1 0.166617 0.463708 0.558119 1 0.165117 0.467423 0.558141 1 0.163625 0.471133 0.558148 1 0.162142 0.474838 0.55814 1 0.160665 0.47854 0.558115 1 0.159194 0.482237 0.558073 1 0.157729 0.485932 0.558013 1 0.15627 0.489624 0.557936 1 0.154815 0.493313 0.55784 1 0.153364 0.497 0.557724 1 0.151918 0.500685 0.557587 1 0.150476 0.504369 0.55743 1 0.149039 0.508051 0.55725 1 0.147607 0.511733 0.557049 1 0.14618 0.515413 0.556823 1 0.144759 0.519093 0.556572 1 0.143343 0.522773 0.556295 1 0.141935 0.526453 0.555991 1 0.140536 0.530132 0.555659 1 0.139147 0.533812 0.555298 1 0.13777 0.537492 0.554906 1 0.136408 0.541173 0.554483 1 0.135066 0.544853 0.554029 1 0.133743 0.548535 0.553541 1 0.132444 0.552216 0.553018 1 0.131172 0.555899 0.552459 1 0.129933 0.559582 0.551864 1 0.128729 0.563265 0.551229 1 0.127568 0.566949 0.550556 1 0.126453 0.570633 0.549841 1 0.125394 0.574318 0.549086 1 0.124395 0.578002 0.548287 1 0.123463 0.581687 0.547445 1 0.122606 0.585371 0.546557 1 0.121831 0.589055 0.545623 1 0.121148 0.592739 0.544641 1 0.120565 0.596422 0.543611 1 0.120092 0.600104 0.54253 1 0.119738 0.603785 0.5414 1 0.119512 0.607464 0.540218 1 0.119423 0.611141 0.538982 1 0.119483 0.614817 0.537692 1 0.119699 0.61849 0.536347 1 0.120081 0.622161 0.534946 1 0.120638 0.625828 0.533488 1 0.12138 0.629492 0.531973 1 0.122312 0.633153 0.530398 1 0.123444 0.636809 0.528763 1 0.12478 0.640461 0.527068 1 0.126326 0.644107 0.525311 1 0.128087 0.647749 0.523491 1 0.130067 0.651384 0.521608 1 0.132268 0.655014 0.519661 1 0.134692 0.658636 0.517649 1 0.137339 0.662252 0.515571 1 0.14021 0.665859 0.513427 1 0.143303 0.669459 0.511215 1 0.146616 0.67305 0.508936 1 0.150148 0.676631 0.506589 1 0.153894 0.680203 0.504172 1 0.157851 0.683765 0.501686 1 0.162016 0.687316 0.499129 1 0.166383 0.690856 0.496502 1 0.170948 0.694384 0.493803 1 0.175707 0.6979 0.491033 1 0.180653 0.701402 0.488189 1 0.185783 0.704891 0.485273 1 0.19109 0.708366 0.482284 1 0.196571 0.711827 0.479221 1 0.202219 0.715272 0.476084 1 0.20803 0.718701 0.472873 1 0.214 0.722114 0.469588 1 0.220124 0.725509 0.466226 1 0.226397 0.728888 0.462789 1 0.232815 0.732247 0.459277 1 0.239374 0.735588 0.455688 1 0.24607 0.73891 0.452024 1 0.252899 0.742211 0.448284 1 0.259857 0.745492 0.444467 1 0.266941 0.748751 0.440573 1 0.274149 0.751988 0.436601 1 0.281477 0.755203 0.432552 1 0.288921 0.758394 0.428426 1 0.296479 0.761561 0.424223 1 0.304148 0.764704 0.419943 1 0.311925 0.767822 0.415586 1 0.319809 0.770914 0.411152 1 0.327796 0.77398 0.40664 1 0.335885 0.777018 0.402049 1 0.344074 0.780029 0.397381 1 0.35236 0.783011 0.392636 1 0.360741 0.785964 0.387814 1 0.369214 0.788888 0.382914 1 0.377779 0.791781 0.377939 1 0.386433 0.794644 0.372886 1 0.395174 0.797475 0.367757 1 0.404001 0.800275 0.362552 1 0.412913 0.803041 0.357269 1 0.421908 0.805774 0.35191 1 0.430983 0.808473 0.346476 1 0.440137 0.811138 0.340967 1 0.449368 0.813768 0.335384 1 0.458674 0.816363 0.329727 1 0.468053 0.818921 0.323998 1 0.477504 0.821444 0.318195 1 0.487026 0.823929 0.312321 1 0.496615 0.826376 0.306377 1 0.506271 0.828786 0.300362 1 0.515992 0.831158 0.294279 1 0.525776 0.833491 0.288127 1 0.535621 0.835785 0.281908 1 0.545524 0.838039 0.275626 1 0.555484 0.840254 0.269281 1 0.565498 0.84243 0.262877 1 0.575563 0.844566 0.256415 1 0.585678 0.846661 0.249897 1 0.595839 0.848717 0.243329 1 0.606045 0.850733 0.236712 1 0.616293 0.852709 0.230052 1 0.626579 0.854645 0.223353 1 0.636902 0.856542 0.21662 1 0.647257 0.8584 0.209861 1 0.657642 0.860219 0.203082 1 0.668054 0.861999 0.196293 1 0.678489 0.863742 0.189503 1 0.688944 0.865448 0.182725 1 0.699415 0.867117 0.175971 1 0.709898 0.868751 0.169257 1 0.720391 0.87035 0.162603 1 0.730889 0.871916 0.156029 1 0.741388 0.873449 0.149561 1 0.751884 0.874951 0.143228 1 0.762373 0.876424 0.137064 1 0.772852 0.877868 0.131109 1 0.783315 0.879285 0.125405 1 0.79376 0.880678 0.120005 1 0.804182 0.882046 0.114965 1 0.814576 0.883393 0.110347 1 0.82494 0.88472 0.106217 1 0.83527 0.886029 0.102646 1 0.845561 0.887322 0.099702 1 0.85581 0.888601 0.097452 1 0.866013 0.889868 0.095953 1 0.876168 0.891125 0.09525 1 0.886271 0.892374 0.095374 1 0.89632 0.893616 0.096335 1 0.906311 0.894855 0.098125 1 0.916242 0.896091 0.100717 1 0.926106 0.89733 0.104071 1 0.935904 0.89857 0.108131 1 0.945636 0.899815 0.112838 1 0.9553 0.901065 0.118128 1 0.964894 0.902323 0.123941 1 0.974417 0.90359 0.130215 1 0.983868 0.904867 0.136897 1 0.993248 0.906157 0.143936 1 h5utils-1.13.2/colormaps/winter000066400000000000000000000002341436105706500164330ustar00rootroot00000000000000# blue-green color map (based on Matlab colormap) 0.0000000e+00 0.0000000e+00 1.0000000e+00 1 0.0000000e+00 1.0000000e+00 5.0000000e-01 1 h5utils-1.13.2/colormaps/yarg000066400000000000000000000001321436105706500160620ustar00rootroot00000000000000# yarg (backwards gray) color map (transparent black to opaque white) 0 0 0 0 1 1 1 1 h5utils-1.13.2/colormaps/yellow000066400000000000000000000000711436105706500164350ustar00rootroot00000000000000# yellow color map (white to yellow) 1 1 1 0 1 1 0 1 h5utils-1.13.2/configure.ac000066400000000000000000000172211436105706500154730ustar00rootroot00000000000000# Process this file with autoconf to produce a configure script. AC_INIT([h5utils],[1.13.2],[stevenj@alum.mit.edu]) AM_INIT_AUTOMAKE([foreign silent-rules 1.6]) AM_SILENT_RULES(yes) AC_CONFIG_SRCDIR([h5topng.c]) AM_CONFIG_HEADER(config.h) AM_MAINTAINER_MODE # Checks for programs. AC_PROG_CC AM_PROG_CC_C_O AC_CHECK_LIB(m, sin) AC_CHECK_FUNCS(snprintf) MORE_H5UTILS="" MORE_H5UTILS_MANS="" ########################################################################### dnl override CFLAGS selection when debugging if test "${enable_debug}" = "yes"; then CFLAGS="-g" fi dnl add gcc warnings, in debug/maintainer mode only if test "$enable_debug" = yes || test "$USE_MAINTAINER_MODE" = yes; then if test $ac_cv_c_compiler_gnu = yes; then CFLAGS="$CFLAGS -Wall -W -Wcast-qual -Wpointer-arith -Wcast-align -pedantic -Wno-long-long -Wshadow -Wbad-function-cast -Wwrite-strings -Wstrict-prototypes -Wredundant-decls -Wnested-externs" # -Wundef -Wconversion -Wmissing-prototypes -Wmissing-declarations fi fi ########################################################################### H5TOPNG=yes PNG_LIBS="" AC_CHECK_LIB(z, inflate, ok=yes, ok=no) if test "$ok" = "yes"; then LIBS="-lz $LIBS" AC_CHECK_LIB(png, png_create_write_struct, ok=yes, ok=no) if test "$ok" = "yes"; then PNG_LIBS="-lpng" else AC_MSG_WARN([can't find libpng: won't be able to compile h5topng]) H5TOPNG=no fi else AC_MSG_WARN([can't find libz: won't be able to compile h5topng]) H5TOPNG=no fi if test $H5TOPNG = yes; then MORE_H5UTILS="h5topng\$(EXEEXT) $MORE_H5UTILS" H5TOPNG_MAN=doc/man/h5topng.1 fi AC_SUBST(H5TOPNG_MAN) AC_SUBST(PNG_LIBS) ########################################################################### AC_CHECK_LIB(matheval, evaluator_get_variables, H5MATH=yes, H5MATH=no) if test $H5MATH = yes; then MORE_H5UTILS="h5math\$(EXEEXT) $MORE_H5UTILS" MORE_H5UTILS_MANS="doc/man/h5math.1 $MORE_H5UTILS_MANS" else AC_MSG_WARN([can't find libmatheval: won't be able to compile h5math]) fi ########################################################################### # Only build h5fromh4 if we are using a version of HDF5 prior to 1.4, and # thus don't have the superior h4toh5 utility. Similarly for h5toh4. AC_CHECK_PROG(H4TOH5, h4toh5, h4toh5) AC_CHECK_PROG(H5TOH4, h5toh4, h5toh4) AC_ARG_WITH(hdf4, [AS_HELP_STRING([--with-hdf4],[build hdf4 utils even if h4toh5 and h5toh4 are present])], ok=$withval, ok=maybe) if test "x$ok" = xyes; then H4TOH5="" H5TOH4="" elif test "x$ok" = xno; then H4TOH5="h4toh5" H5TOH4="h5toh4" fi HDF4=no if test "x$H4TOH5" != xh4toh5 -o "x$H5TOH4" != xh5toh4; then AC_CHECK_LIB(jpeg, jpeg_start_compress, [AC_CHECK_LIB(df, DFSDgetdata, [H4_LIBS="-ldf -ljpeg"; HDF4=yes], [AC_MSG_WARN([can't find libdf (HDF4): won't be able to compile h5fromh4 or h4fromh5])], -ljpeg)], [AC_MSG_WARN([can't find libjpeg: won't be able to compile h5fromh4 or h4fromh5])]) if test $HDF4 = yes; then if test "x$H4TOH5" != xh4toh5; then MORE_H5UTILS="h5fromh4\$(EXEEXT) $MORE_H5UTILS" MORE_H5UTILS_MANS="doc/man/h5fromh4.1 $MORE_H5UTILS_MANS" fi if test "x$H5TOH4" != xh5toh4; then MORE_H5UTILS="h4fromh5\$(EXEEXT) $MORE_H5UTILS" # MORE_H5UTILS_MANS="doc/man/h4fromh5.1 $MORE_H5UTILS_MANS" fi fi fi AC_CHECK_HEADERS(hdf.h hdf/hdf.h) AC_SUBST(H4_LIBS) ########################################################################### AC_CHECK_LIB(hdf5, H5Fopen, [LIBS="-lhdf5 $LIBS"], [AC_MSG_ERROR([hdf5 libraries are required for compilation])]) ########################################################################### AC_ARG_WITH(octave, [AS_HELP_STRING([--without-octave],[don't compile h5read Octave plugin])], ok=$withval, ok=yes) H5READ="" OCT_INSTALL_DIR="" if test "x$ok" = xyes; then AC_CHECK_PROGS(MKOCTFILE, mkoctfile, echo) if test "$MKOCTFILE" = "echo"; then AC_MSG_WARN([can't find mkoctfile: won't be able to compile h5read.oct]) else # try to find installation directory AC_CHECK_PROGS(OCTAVE, octave, echo) AC_CHECK_PROGS(OCTAVE_CONFIG, octave-config, echo) AC_MSG_CHECKING(where octave plugins go) OCT_INSTALL_DIR=`octave-config --oct-site-dir 2> /dev/null | grep '/'` if test -z "$OCT_INSTALL_DIR"; then OCT_INSTALL_DIR=`octave-config --print OCTFILEDIR 2> /dev/null | grep '/'` fi if test -z "$OCT_INSTALL_DIR"; then OCT_INSTALL_DIR=`echo "path" | $OCTAVE -q 2> /dev/null | grep "/oct/" | head -1` fi if test -z "$OCT_INSTALL_DIR"; then OCT_INSTALL_DIR=`echo "DEFAULT_LOADPATH" | $OCTAVE -q 2> /dev/null | tr ':' '\n' | grep "site/oct" | head -1` fi if test -n "$OCT_INSTALL_DIR"; then AC_MSG_RESULT($OCT_INSTALL_DIR) H5READ=h5read.oct else AC_MSG_RESULT(unknown) AC_MSG_WARN([can't find where to install octave plugins: won't be able to compile h5read.oct]) fi fi fi AC_SUBST(H5READ) AC_SUBST(OCT_INSTALL_DIR) ########################################################################### AC_ARG_WITH(v5d, [AS_HELP_STRING([--with-v5d=],[use Vis5d in for h5tov5d])], ok=$withval, ok=yes) H5TOV5D=no V5D_FILES="" V5D_INCLUDES="" if test "$ok" = "yes"; then AC_CHECK_LIB(v5d, v5dCreate, V5D_FILES="-lv5d"; H5TOV5D=yes) AC_CHECK_HEADERS(vis5d/v5d.h) AC_CHECK_HEADER(vis5d+/v5d.h, [AC_DEFINE([HAVE_VIS5Dp_V5D_H], 1, [[Define if you have the header file.]])]) elif test "$ok" != "no"; then AC_MSG_CHECKING([for Vis5d object files and headers]) if test -r "$ok/src/v5d.o" -a -r "$ok/src/binio.o" -a -r "$ok/src/v5d.h" -a -r "$ok/src/binio.h"; then V5D_FILES="$ok/src/v5d.o $ok/src/binio.o" V5D_INCLUDES="-I$ok/src" elif test -r "$ok/v5d.o" -a -r "$ok/binio.o" -a -r "$ok/v5d.h" -a -r "$ok/binio.h"; then V5D_FILES="$ok/v5d.o $ok/binio.o" V5D_INCLUDES="-I$ok" fi if test -z "$V5D_FILES"; then AC_MSG_RESULT([not found]) AC_MSG_ERROR([couldn't read Vis5D object files in $ok]) else AC_MSG_RESULT([found]) fi H5TOV5D=yes fi if test $H5TOV5D = yes; then MORE_H5UTILS="h5tov5d\$(EXEEXT) $MORE_H5UTILS" MORE_H5UTILS_MANS="doc/man/h5tov5d.1 $MORE_H5UTILS_MANS" fi AC_SUBST(V5D_FILES) AC_SUBST(V5D_INCLUDES) ########################################################################### AC_CHECK_HEADERS([arpa/inet.h netinet/in.h stdint.h inttypes.h]) AC_CHECK_TYPES([uint16_t, uint32_t]) AC_MSG_CHECKING([for htons]) AC_LINK_IFELSE([AC_LANG_PROGRAM([[#if defined(HAVE_ARPA_INET_H) #include #elif defined(HAVE_NETINET_IN_H) #include #endif]], [[unsigned short i; htons(i);]])],[htons=yes AC_DEFINE([HAVE_HTONS],1,[Define if you have htons.])],[htons=no]) AC_MSG_RESULT($htons) AC_CHECK_SIZEOF(float) AC_MSG_CHECKING([for htonl]) AC_LINK_IFELSE([AC_LANG_PROGRAM([[#if defined(HAVE_ARPA_INET_H) #include #elif defined(HAVE_NETINET_IN_H) #include #endif]], [[unsigned long i; htonl(i);]])],[htonl=yes AC_DEFINE([HAVE_HTONL],1,[Define if you have htonl.])],[htonl=no]) AC_MSG_RESULT($htonl) if test "x$htons" != xyes -o "x$htonl" != xyes; then AC_C_BIGENDIAN fi ########################################################################### # Store datadir (e.g. /usr/local/share) in DATADIR #define. # Requires some hackery to actually get this value... save_prefix=$prefix test "x$prefix" = xNONE && prefix=$ac_default_prefix eval datadir_val=$datadir eval datadir_val=$datadir_val prefix=$save_prefix AC_DEFINE_UNQUOTED(DATADIR, "$datadir_val", [datadir installation prefix]) AC_SUBST(datadir_val) # check for POSIX wordexp function if we need expand ~ etcetera AC_CHECK_HEADERS([wordexp.h]) AC_CHECK_FUNCS(wordexp) ########################################################################### AC_SUBST(MORE_H5UTILS) AC_SUBST(MORE_H5UTILS_MANS) ########################################################################### AC_CONFIG_FILES([Makefile doc/man/h5topng.1]) AC_OUTPUT h5utils-1.13.2/copyright.h000066400000000000000000000024571436105706500153730ustar00rootroot00000000000000#ifndef COPYRIGHT_H #define COPYRIGHT_H /* License and copyright string for inclusion in program output: */ #define COPYRIGHT \ "Copyright (c) 1999-2023 Massachusetts Institute of Technology\n"\ "\n"\ "Permission is hereby granted, free of charge, to any person obtaining\n"\ "a copy of this software and associated documentation files (the\n"\ "\"Software\"), to deal in the Software without restriction, including\n"\ "without limitation the rights to use, copy, modify, merge, publish,\n"\ "distribute, sublicense, and/or sell copies of the Software, and to\n"\ "permit persons to whom the Software is furnished to do so, subject to\n"\ "the following conditions:\n"\ "\n"\ "The above copyright notice and this permission notice shall be\n"\ "included in all copies or substantial portions of the Software.\n"\ "\n"\ "THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n"\ "EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n"\ "MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\n"\ "IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\n"\ "CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\n"\ "TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n"\ "SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n" #endif h5utils-1.13.2/doc/000077500000000000000000000000001436105706500137475ustar00rootroot00000000000000h5utils-1.13.2/doc/h4fromh5-man.md000066400000000000000000000034421436105706500165010ustar00rootroot00000000000000# h4fromh5: convert HDF5 scientific dataset to an HDF4 file ## Synopsis h4fromh5[OPTION]... [HDF4FILE]... ## Description `h4fromh5` takes one or more files in HDF5 format and outputs files in HDF4 format containing the datasets from the HDF5 files. (Currently, only a single dataset per HDF5 file is converted.) HDF4 and HDF5 are free, portable binary formats and supporting libraries developed by the National Center for Supercomputing Applications at the University of Illinois in Urbana-Champaign. A single HDF5 (`.h5`) file can contain multiple data sets; by default, `h4fromh5` converts the first dataset, but this can be changed via the `-d` option, or by using the syntax `HDF5FILE:DATASET`. The most basic usage is something like `h4fromh5 foo.h5`, which will output a file `foo.hdf` containing the scientific dataset from `foo.h5`. ## Options * `-h` — Display help on the command-line options and usage. * `-V` — Print the version number and copyright info for `h4fromh5`. * `-v` — Verbose output. * `-T` — Transpose the output dataset (e.g. LxMxN becomes NxMxL). This is often useful because HDF5 programs typically follow C (row-major) conventions while HDF4 programs often follow Fortran (column-major, transposed) conventions for array ordering. * `-o file` — Send HDF output to `file` rather than to the input filename with `.h5` replaced with `.hdf` (the default). * `-d name` — Read from dataset `name` in the input; otherwise, the first dataset in the input file is used. Alternatively, use the syntax `HDF5FILE:DATASET` when the input file names are specified. ## Bugs Report bugs by filing an issue at https://github.com/stevengj/h5utils ## Authors Written by [Steven G. Johnson](http://math.mit.edu/~stevenj/). Copyright © 2017 by the Massachusetts Institute of Technology. h5utils-1.13.2/doc/h5fromh4-man.md000066400000000000000000000043431436105706500165020ustar00rootroot00000000000000# h5fromh4: convert HDF4 scientific datasets to an HDF5 file ## Synopsis h5fromh4 [OPTION]... [HDF4FILE]... ## Description `h5fromh4` takes one or more files in HDF4 format and outputs files in HDF5 format containing the datasets from the HDF4 files. (Currently, only a single dataset per HDF4 file is converted.) HDF4 and HDF5 are free, portable binary formats and supporting libraries developed by the National Center for Supercomputing Applications at the University of Illinois in Urbana-Champaign. A single `.h5` file can contain multiple data sets; by default, `h5fromh4` creates a dataset called `data`, but this can be changed via the `-d` option, or by using the syntax `HDF5FILE:DATASET` with the `-o` option. The `-a` option can be used to append new datasets to an existing HDF5 file. If the `-o` option is used and multiple HDF4 files are specified, all the HDF4 datasets are output into that HDF5 file with the input filenames (minus the `.hdf` suffix) used as the dataset names. The most basic usage is something like `h5fromh4 foo.hdf`, which will output a file `foo.h5` containing the scientific dataset from `foo.hdf`.` ## Options * `-h` — Display help on the command-line options and usage. * `-V` — Print the version number and copyright info for `h5fromh4` * `-v` — Verbose output. * `-a` — If the HDF5 output file already exists, append the data as a new dataset rather than overwriting the file (the default behavior). An existing dataset of the same name within the file is overwritten, however. * `-o` `file` — Send HDF5 output to `file` rather than to the input filename with .hdf replaced with .h5 (the default). If multiple input files were specified, this causes all input datasets to be stored in `file` (rather than in separate files), with the input filenames (minus the .hdf suffix) as the dataset names. * `-d` `name` — Write to dataset `name` in the output; otherwise, the output dataset is called "data" by default. Alternatively, use the syntax `HDF5FILE:DATASET` with the `-o` option. ## Bugs Report bugs by filing an issue at https://github.com/stevengj/h5utils ## Authors Written by [Steven G. Johnson](http://math.mit.edu/~stevenj/). Copyright © 2017 by the Massachusetts Institute of Technology. h5utils-1.13.2/doc/h5fromtxt-man.md000066400000000000000000000054711436105706500170110ustar00rootroot00000000000000# h5fromtxt: convert text input to an HDF5 file ## Synopsis h5fromtxt [OPTION]... [HDF5FILE] ## Description `h5fromtxt` takes a series of numbers from standard input and outputs a multi-dimensional numeric dataset in an HDF5 file. HDF5 is a free, portable binary format and supporting library developed by the National Center for Supercomputing Applications at the University of Illinois in Urbana-Champaign. A single `.h5` file can contain multiple data sets; by default, `h5fromtxt` creates a dataset called "data", but this can be changed via the `-d` option, or by using the syntax `HDF5FILE:DATASET`. The `-a` option can be used to append new datasets to an existing HDF5 file. All characters besides the numbers (and associated decimal points, etcetera) in the input are ignored. By default, the data is assumed to be a two-dimensional MxN dataset where M is the number of rows (delimited by newlines) and N is the number of columns. In this case, it is an error for the number of columns to vary between rows. If M or N is 1 then the data is written as a one-dimensional dataset. Alternatively, you can specify the dimensions of the data explicitly via the `-n` `size` option, where `size` is e.g. "2x2x2". In this case, newlines are ignored and the data is taken as an array of the given size stored in row-major ("C") order (where the last index varies most quickly as you step through the data). e.g. a 2x2x2 array would be have the elements listed in the order: (0,0,0), (0,0,1), (0,1,0), (0,1,1), (1,0,0), (1,0,1), (1,1,0), (1,1,1). A simple example is: ``` h5fromtxt foo.h5 <~=wcn~?/: Տs3-ٹ_/_uzx|vWݞE_E?^P\z5ū?ܝxléé6KW~_ӪƮ]] ݯ+v]>mx珯7s|ns]DPJB @(% PJB @(% PJB @(% PJB @(% PJB @(% PJB @(% +aeHIENDB`h5utils-1.13.2/doc/images/Cool.png000066400000000000000000000004061436105706500166160ustar00rootroot00000000000000PNG  IHDR27"IDATxA@BowMUUS@D@D@D@D@D@D@D@D@D@D@D@D@D@D@D@D@D@D@D@D@D@D@D@D@%qrIENDB`h5utils-1.13.2/doc/images/Copper.png000066400000000000000000000006261436105706500171560ustar00rootroot00000000000000PNG  IHDR27"]IDATxj0љC"j]&mQ>ƲNW1鼫4ߖ}>ss]x}y|?>^O9ߗ_eқo״x>O^mQoqm_{??zqK߹1> HJB @(% PJB @(% PJB @(% PJB @(% PJB @(% PJB @(% P >:rIENDB`h5utils-1.13.2/doc/images/Dkbluered.png000066400000000000000000000010031436105706500176150ustar00rootroot00000000000000PNG  IHDR27"IDATxKn@ @f1 >vf ee?j515Uãz5' sS'|L [ӇImWvdw-4Kegs]k,cYj\o>s?gשW謎~knu]֭]|t?ogw=9e[ǵ^֮S]_׮k5]lZlNIOz 66q2f}nkafx@(J@(J@(J@(J@(J@(J@(J@(J@(J@(J@(J@(J~vJTR IENDB`h5utils-1.13.2/doc/images/Flag.png000066400000000000000000000007301436105706500165730ustar00rootroot00000000000000PNG  IHDR27"IDATxձ`3Bp@H!xAT #X+X^\k?߯U5Mu|׿òo@tCyF|H~IDDGGKKWWggxxww  +8"%%7711LFTZ_ f|u & 4 = GGVVNNWWffxxppFQX^h6:# &*-<04: */Oph<6 ((66DKRg!k"p"\W^ c!u"HHYYMMggxxpp}}N"%-:IXgvm탃0GUp"""#%,7""?HW_hwB"#"""谰ب䜜ޘȘ‹ӫضʫ׭ۑگ獍긄鰰߷ۯǔаǢƜԨ۷˭` pHYsHHFk>KIDATx} Uo$WY Wy a ^uwo$wAL~ ADV+@HHAX]L0!CI`$NL5='g$c=$8u9W]Uݧ:r 3u>u8|eoUŝ(#l?Z. e(mT(ھ<Ƶa2R$=&\gM`Ƙ(mSRDC3y ڡ+@GisRĀD4KM1 :jmkMKÏ-1!nqibE@W=s݂3uyc?k̙q] )~o s=f>\*Mh+A%gj&Cmd%EkWMkÎsr3SFUYL~TWP(/Sԕb1Ok?B.2Y -IlSZy9ѮCg FZb]} ݢ?Yf 1#W@W/Ugqf>}վ"vu.łS 7[}Իk􆥠_(akwߋf]շzb}9/;纥7Ѷ]w(xK%o\<)1[Q4hM%lnvCܛR(~xcI-Mim>:ʣa+IY y3g\g4o)CMs/fvJEˏB)oՌ*u|;w Luq^qЂj!䣳K3e˔֤Df:<>Zsƴ33K1C>Rp@isyRhMeI5Ch,Z_9J[$])85Ǯ 73].m,gR} GLjUR A9/K˅Ê/'z}jΙ=<ϳ#5/iIT 'N$nG`ca'Om)sѵ_Uq:̍7nǍS3e4uC'4ٹRyì\VAS6?)¹q{iu;eWT2bKä?+ k&Kl-2F+1yhA">;$4J]xFkgi|ta)\F ХsRM`_ami.Tsp& GvJdª~a2̖,Wnޫ^["xj5):',n_<}Fǻ5{O8Xw䀶-d`i bc5)r3 9[ÊT$mcv$+ /[^ںB.8-pBq1lЛO]"SLnQ*Ra>qk gtFyē TT]@Uf?l@ .9ftܬܐd듲l'j :[+*WBEDS)}b^+<=}BXnky>l[\N!^TmvF^9}Ţjp;@+ay?m iߟ ߓx?!_Yx=ZN?+^P@+oAg?;|.\ɏyAZ_fˏ[}sM}TۙyŵMf2jgGi hC-n6NhׄUh&0BW:DK{xG1cN[ fj<١T1|3WTfUHpIr0|TsJ.tuXbɌDB%g~^q|ʅ᭱f<|^:iQSx)֜a>~1q)*m=ؘsB(t:9WuZs|Bm"x08rט8=pAR 1 `}9zoRX+ NtXN箹WH )*rWW6j?IAWu,b@kz4~S^)ãJEe!(y9#dB5ӽ j͇ ")U^'{K׹]엫랽馕w&6{$bț**8#ːK%F:0n++8PWj0)!<خPqJUW(]0 ^ IЪhDYUAۭUԌraT5}_GTk$]、> _nion# (!/|uhtfTȮ+nDpzkNJJ[e!&)=Յe]W~)ȎY^vvE"Iokj1)iUAxu^@h;,0\ڣ2扢ҩqIghGK7.A]33 C'E(rb}z#0Zv/hoȐ(^-iO.AMkв$ JMP!F[X$gMp)]ʢW/zWs1%]5)K0tKĽ͚$^g O [#BN^]̕{vfUϩQ _o{$nޔbyI<W4Вv߸3JI\9X؁VP1Cb<+u`)?y8 ׊k 2tKj.mw0hBL7ñcpC+2x#KYMvBv^}+>[ҖCZY6Kf39L"KwZe;~B[@Ou[$t[7'[YЕ^_r-2[$<,^t5K,.ڔ;}Y4m)'h!эUQ^m)ŋ[l)t%N kuY;PR쥙nhSo8 tC3:WSk hoj, mVWVq溡摋Gݯ绋[zC&O4,/r94G- " owzp,xށhi䪧#hQU*'7~!pkb/s9q 0>Pt7}ժod hU<e?r8hJnȹ)s`e']zz B5)SSMCKn; ,=[uHyI2j@[-tK$x :@zwKzef栤baTJdZG8Xި]{\2"n+@Drft3 cI@52T Lb'ܪAQj*5iNӂ9r=H2趔Awn I]x祢6GkfC({F)S :0vuE-iJ\ i EspMw\]\%ms?%5ǹFqhF6^zV%_"otp=wwl+:_ l=4>+V%Y"[hɛ\Y=@cwρ\yˠZq º daJ)> ]I^z.z@7"Ք0$p魌R?/u_uVR4ä+ɛPM)EBWJЁ,@|F*+|R@'Hyumxb1>%0t[ǂ8rzPsxl}FDJ7:/?t_\%h j.7"sE@d̾k\`3x %8~tj8vܒnY{ ڳUfj>ř߉_fnѿ-niߐEIY/Z53W}J~& -5'I]>\[%qm$q~AJX0gLCL1m`Il`QOj5D:!:a5LY A' ݠNfיAWz)eC7BS]iE1tirR67k(]s5)[2C[pf&U5 hV1ٍ)[}0ev ]р3i";28` ε f!" EoeER=Y9t a V+]':: ) 0xsjEmo-%oK7o|hρQA3x{Kޘ>ooBau&_u8>7woݺ[ܑ/hk:)WdJ&yWHl^NV Fjmf&y $ӧiɭ ڪq1I6,r2"[ ^]$U8ʊ'EJ)~Xy܇:_ZH>-E"Qx*hYbMJ*z/>zonG |UIޡ{<[n!V^f%~$Ō@2Ki3$}~W԰$3g3W+)N٨Btmijj25i as]61aa4>T108qr]1MI~(s]LZtXzyS٭ץЛҜ3飆0ɹ.O٘KL1vlA2tnKlYQeX!b]x.ےu֖n~އu\wypWp5-IU:WsZa !vAqD#gv+nGBC RB2Ӷ-[摴C﷥mJ:yjWnުv xu/0$0GT>4m*a :Av#CIM5̼{i3_.:j))u-?ZbKҠa6!LlYuq::,o)!u;7CJMsnJ+,+::MZs՞N1sF'm_* gP˨\2NY(,y 3؟~~Q"7U=kuڢĜW2'*Ӈiӊ:hU4N]?"9hQ%Ew_G)GíǗ oau7ܔ!luqx׻wӶ®kZNՔнoKD%}+|C̠{w{jv]佤> Nq]%R9h\C^Ƿ7+֠uGK{m]K,p(E}퇷Ic@P9ğg>*NLB8ꨣd5-s]eEr_,Ktn0f\wg>OK>Z=q8iW3K!Wu:DKߗ6]mnhțbhOb$ކc~ !Ι$rAO.p]\#v#}9 Е :6ر,gtjn&9m6\%k>u=!Â5ץ802t)@uCg ].h;溔JRMMuD`2侟l L0lrTv]qЛ\wWE8!v] \'Kěr1̠cqL`oJ )q2iaIurיahׅCD ¸L9d1O> 4pHwׁqYX`>v]WƁh7 Jz忿}-(x.% \Tw}gJ>@7%ޔ$r~;+ro}[Uw:/c_kPCLVtAwC2] 1#~O,NнWrݷxn!"9P^*v~Ո몆ȹ0=<t TN AWC&^7M:U@gW!ǠcLG\05AGN\W tMT^b}#[acY̞E:NzXסŴFPq5P O8: L';wx ʇz,TUzйs͓5kL-N~K}s7!Q:Y#pmv]u>Zu& /|_?{^ԧ1๎Ga; ^SK`7Q-^|)/Q@NMuG>I^:q>)-0)WS=*P`rxu?]]7 ^|^pnS]<52 aEaGu;χuD`='΃{St wݸnM_tT:W`! SAɏhC0t\<C'ꑄʡ\GI~,㺋[⹎!GMd;[u$/T\w≾Tu:XNrױ]'U91:}:8tO)Б;Jesqij9s(rK/uvt>6jkBxtg5L!\\Gcʠ˕A_Aٮ+’j ! .q߳0mJbޥ8͢qf}b|W׽@wD_p.(:~t%&.osxy,ߊ0cSܓ\7 C0{M.oC4L`B|5lfB*͎3\a)N<j t2RŹ% h?lxD`s. ],]i5!tB)tC2 Jue&SP@:XsTV?va1_N=u몂論J!\(vFB.:OK$YQEʼOgir<aubYQZ.1]9t|ZK^t|>=9:Qd ap@uuU]! K'r4SS +:]8ЅpוC'\`!TE7.:7-7-WӖ CjJ9t:C')n% \W*Ʉ)ZMQ\'.yuղP`庀l͸g,+AbN}[).zjW 9s'SyHV?WNxuB'-!Svvvz4뼹3#Na H2u4=FUa&{ʹq〚rw$9 0t|k:E\wv&B~~{C.x<ם?_!d1heNkaVS4t]2EAY\J&AmP2GJQ ;Y@u~5E*CGcCKnpׁΟCJKvڕaF'){.]W#_p;Μry6:\ǘ0e|q>;4۫H7$7 j)s so2l1_t`Н8%|\WRЍF0'lGi/ 뺣>0?WSN> Lǡjqu ̳f6Stu矏.B)N%;@}:.sPf$t2ND4 *:t\*0 'ʠ;YBPav]I.\qOy;n2vt<tsr:? ˿"N tHkA;J;L'  XqtX ύ`.Q r 纨MZ>v)Fu$vN]U@wc9t;u ƚ矏)~Z!C|7:nC)WS}^B)bTqarL8g.gY0U%c(/k9isǓ]OOz]н;t.'9Kϒ"=vN}΃ 5tY}X ٤%}fys]G;tM 8ld-/'ώփ;K[+~ϐ*O̩U$6~(h}}ZMZ@,xuoEjuǾjaߧqj7m 0h3ڍ;[)9R2שɮUmm[+ LSu>_?a ^|5L"/纯˽*á}V!Y-\-0}ZO,_@Z]]]w,xzF,nqPٮ\WAM rȻkMrja~CSsׁr$-+r*CLoJ5\uR]DB.)tNtǔ|iy0X0O:tCđ7ZsqstNtYBuz ktguz䫇 8,WЕ0{|Qrp[p7Ǜ^N |}F}^ڒo ?V8 c4v 0:maʪ:4pwX~,#D=J0M^Rڪ$D Mh[4*iKns:RuIPK`D~Fd4$ ?1mTbξJ0Cq~f*&4ImTRL6ӶdX3\g"02E_-5thiȇY%ms4Lmtj>ρt R ]'N\g`ו/b}Cs]s4eBzjJ. J5A&y"]fJzq]S4̼tFBԔCXÌG&ŊIfLڕ 4JKf5%Q2LiW3֟ē$#iiOf|TeOtXrĜT&L#|ڂQ<}okL 985 >vգ)): 3F4ˮK3'Y'0B6%fAh)\Д)&A-\O\Wb4\'Mk4K9\oJR<.YT39R}|}ڔ֪ץ\fIK$]z 9,uv8]tѴ9S3tŊErpAk 譑F0ӡa&-a#k&Ll[>B֞5Mw0V?#^>X]Ƶp]!1Ca@` ktZ1r7y/o溱8q$} &jJPk 4̉ k}=yqv0C\}o) lk;8mqz_5VaMK0%`L<ʹq3qvжǴTu)h0))9c0ʼna48Nj}$#tpM[TI7k٘B_ؾl ӣMoMf;;$YIÕ9ǝñ'tfD )<7j5Ek) m_i)tlujrl_bySRI+:bմgح]Af,(vux$0u6yw0UDZ0Lzuk+fNt:Mrj4L 䗶r{klx⒫zz$5u4Zx&@ ]ۃHSA<$1C8L Gp@{Vk)cǁ-}Ǹ]džniE%nx]=>J]?d}lĦ5 ~@$4P6ŰD[jJmS ~֨~uh>qjXtZ-0%m Ķx-6b9]yC3^C`6( J] -HsVAvj8EBk\&WWߊUK[ v'zYZKYk&"Ws3O LP%MٷU@aDS"j]8gv#JZ ɪqGY$dΩ ==4ez ?!ceN~T|V&Uu2Q"lv?' /Z@`@Jޗ{Q^=Гzzv20:g֎L0Q<( (RZ}-}yR-hsѴ/' H/@*+}S{Qy9ս6ЮnȏaRg ?K]faփuړh">fu@NR{/!}Rݾ^+aRF\rS((?z4OB9!G6\ezXǵ!3tr 8"tC{/y/j̀djZ¤7iR%yAjZi*ڍ,/'~1zu:fMeך \Qq8N2jh7JJ Uf W3jn24vprޔQv9ėU(В-LTE@'>@wK3>ySuk&r]e*nf?m֨)ѹFU4w`|XhfBW0M*)]IA$hvek*Z:hUfzͻNmLލƙAq1٣݇9q. GKs];N֠8㈘kS`c-E۫wX:Uk'CASN}k( 4:)/Lx9Ι΃.  ԩ?F5%Xɾ\v*6\K}-q撝@5vp1?;+A'z!zwNSA\L8td@qJGеܑ7rZЁ jAs[pOJ+zs zƭ}4iuӥqI:sA=%wSwMt){v1a-ٶ9YsXwkǫIr\T_EI@XMnI0'u_?mCOC*#{ OrO.)m>rh_fwx'ʿF;ˋk ߉I &d;;S{s̝.|=`FO6;负wdrOG꟣sn̉ﵚeMyUD"Twdڨ"r9A"(Pn.cq!9"N+?[=ΞH9/h'ebt- *0%=t@;&Lut2))\,:\}/ 7O`&&r;2`-FD#P+Fwj `ܢ2#溽r;0vCqy^J7\I%&iSؑt1ɍ6^1]G^f]pmz PC{?mPNPkZK:J e0I)ޜ3ڑ!pҙƉav;a!rk/Eֈ%&+m8tR^NL5Cbqg)~,Ñ%kmJt:ce3z `ڑ' ,< &KQb0Wvi+@JCI*sg(tyJ74@ m\-)h1Er(9 PK[P:X^"{#cw`@'c9epr3@pqQ Q6Lߠڝ) %o3j K]W=y%? +OSNuZK9hB|߮9u=qR!0*38X  jRx'O0t Nwt/km2783wp8-A )6aOG$ptUpS`x|AkUz&"p](t;eA8+yXwɇ'wh-Q #mhSfq7MG:z%wwvMMWMP̌Lig dC?6ٛ,v-m)6#% Xliv-t=ݜq*?d8ߌm>wڤ)Vwwue@O]uD+fp]:ک떅Lf^fkpvطMdǏ=ɫuJƶmsdݵadA7Z] 'C.h)߁"xlV%]u鲝?z`>FPG'NJ%L3N~1:e7li*3-N^yӔ=^`s:Wx"Lqf76u,0EcNCq_c=i.LPHKQ3j ̄y~;9SR"%a6ځ^qE/hW.;) w>4tFO.u%tSR 蔽Π^a:巂oPM^Gu9TqZ"JInpIi]]%E-%w98SYux7 [ΪSNs2Q9\#wAryøG O9i={/zZSk4?t%[uO;J8"餴&՞5'z3wzZۀha&\͡wg!qBA87z fW =Bzn4`뾴-dX!!>0 6%vWKz Gb>tzik;.3٧F+%n˗AAۘPkK9]bONUpzmPl4xFB G\wpŘ#DYqи<է1iϯ1S2v!4˳;Vy{G>B0!Ym 2cI| Ŵ\Ǡ%r̞^,Wcĥ^v] Z|;}'Q\gw,djqA`J>%9?1 "בEߚ<ø&ņZQK]!,cSU&SYim˗ ;bY^r וG.KhcFa7tr4Y>k3z7T3Y3{ZRl7e˸jnXݍvo[Х\l1-Ėv*6UG3tjfBy-Y&I΀PRK-Gq UYKl۳L92Ä`)J9}J ?RVR0 a+/l㜛$ KMr(+pGs@Pq`+OarbE砯t.@|ۍLep2ʽrB1l)t&k+ìW&x(4\(ym̰(ծ>s] אiE^WU4t _ǺB࿽ey# ciE1&V.)Zw_Z \[i/c䣥B#Jz>FH%; R?bۉ#ms6 GR;}Lb{j7ρ-F9 ̖>#`\i ;J5`NX픖+ߞĸLǻ-?6pިͥlڶeBZb90sYy͏8fCx=2[ ^˺VkۈV&$kwf3S r+c osJ9¶m`nGwŝCx>d9ڴzztrbu'MQÝ͡aQ]f"~ >R xF&M|Ƽyq ^PUvaqhm35&>hr/PW:ޔ&FeUV`e+H_GiBtؑxtu[J4Ȯ8lB3ӃfJ٭ktOPtyAxd/yf+lWV *LQYbhc@ה-Ƴq[~nJ !I$ET(k6sSt2_â䔶 x`31[b4(*MLǤMqn)*:QGV.ҩWS͈ćIsF$e O$}vͳ`*5mwe‡o$na7s{累E]y> u鉇~@@!'w˵m>L6(P'f#<_?2vM }OxXx|yE2tܥ=X%m,ˈJ{]$3v]6$/Wkr4͇iVsaVʹu;q=cA8h3݇oӘ$7:-ޔtn").7 Mjr Z̵Zc0%7mڔt))ꔗ<7%%f"aku>ڦu&P3K*LZ-]M#%([%MiNDKiLϒj%ꄟ($Wf@Lg]cZ~8'nGŲ" g;l$Y]IENDB`h5utils-1.13.2/doc/images/Hot.png000066400000000000000000000004631436105706500164570ustar00rootroot00000000000000PNG  IHDR27"IDATxձ 0@viAp`@z!#&]5feqئm]ꮱuzqw~Q I J J J J J J J J J J J J J J J J J J J J J J J {a]K:3IENDB`h5utils-1.13.2/doc/images/Hsv.png000066400000000000000000000005041436105706500164610ustar00rootroot00000000000000PNG  IHDR27" IDATxAN1 AO]è[}3/_oxg޿=?oǹ!_x~s־,=5$ @D @D @D @D @D @D @D @D @D @D @D @D @D @D @D @D @D @D @D @D @D @D @D @D} R͏IENDB`h5utils-1.13.2/doc/images/Jet.png000066400000000000000000000005071436105706500164460ustar00rootroot00000000000000PNG  IHDR27"IDATx1n0 AS~&$nvlĂ*w|~myk=y>f5o=k9oy?1$ @D @D @D @D @D @D @D @D @D @D @D @D @D @D @D @D @D @D @D @D @D @D @D @D}z052x6IENDB`h5utils-1.13.2/doc/images/Lines_color_map.png000066400000000000000000000013631436105706500210320ustar00rootroot00000000000000PNG  IHDR27"IDATxn@@ pVT)$kL:G/{![yvuDN"F]sd>Ⱥ"ͼ8y>s׉ B|_=ޗe1}]}}}of!e~}i1ѿsbl:C0)d [Cԣ>vJYi!.Q?ݗΐ]gvͤRzsܪ[^M;CǠ,zkKZ8n?dz?[oٲ3dS3Σ̛8L!$guW_/T~/TV ^ԭΎIy^Q[i!.W/TIճz>[]V2\;Q9>oAPey}˳:I"`E(F0Q"`E(F0Q"`E(F0Q"`E(F0Q"`E(F0Q"`E(F0Q^\^IENDB`h5utils-1.13.2/doc/images/Pink.png000066400000000000000000000007641436105706500166320ustar00rootroot00000000000000PNG  IHDR27"IDATxAr0 @@;g kEIT0$ TMW뺬-}˲,˶^^dQu'âfG&[t]>]^ʪ?/kTyzUVuޏ.7uWءz:}>>=gki`Vya5L[gսx|]`1\\|֭Rkox|a}Cӽ1nSM{Nkmaۿ %B P %B P %B P %B P %B P %B P %B P %B P %B P %B P %B P %B P Fa5IENDB`h5utils-1.13.2/doc/images/Prism.png000066400000000000000000000005451436105706500170200ustar00rootroot00000000000000PNG  IHDR27",IDATx1n@EqZ"\@wF_S |͝^IdNsɖ'Թ<ǚu7_%}vWc`}`eY/emlGdMd3j3}k?ױϸ%k2JPJJ @)(%RPJJ @)(%RPJJ @)(%RPJJ @)(%RPJJ @)(%RPJJ @)(%R ts\sIENDB`h5utils-1.13.2/doc/images/Winter.png000066400000000000000000000004111436105706500171660ustar00rootroot00000000000000PNG  IHDR27"IDATxA@|Bmmo7֍7 ~W<IENDB`h5utils-1.13.2/doc/images/Yarg.png000066400000000000000000000004051436105706500166230ustar00rootroot00000000000000PNG  IHDR27"IDATxA0 mNUUS} aTIENDB`h5utils-1.13.2/doc/images/Yellow.png000066400000000000000000000004051436105706500171740ustar00rootroot00000000000000PNG  IHDR27"IDATxA@i{BmTU$@D@D@D@D@D@D@D@D@D@D@D@D@D@D@D@D@D@D@D@D@D@D@D@D=$qHÚIENDB`h5utils-1.13.2/doc/images/inferno.png000066400000000000000000000011041436105706500173560ustar00rootroot00000000000000PNG  IHDR27" IDATxɒ0 @@2s0P9Rd2oDddDDfļw7wA>g >132Zɓ{:"w]ezԩXS{oYyБhJ4%M @S)ДhJ4%M @S)ДhJ4%M @S)ДhJ4%M @S)ДhJ4%M @S)ДhJ4%M @S)?FUy(IENDB`h5utils-1.13.2/doc/images/viridis.png000066400000000000000000000010611436105706500173710ustar00rootroot00000000000000PNG  IHDR27"IDATxKv Pz[6`u"'.#3"?c9lru:yފz9t,TV""v~Ns}]X/{2Μ}[v.79ǩϊo /oq݊{VcnmςymktXZݿly`2܋~ּ+_M{;֗[s(zfor:/ zFm\[ўSφq^rt2J\+拪WgdDoe=3?=f JE @Q(P(J%E @Q(P(J%E @Q(P(J%E @Q(P(J%E @Q(P(J%E @Q(P(J% m;"IENDB`h5utils-1.13.2/doc/man/000077500000000000000000000000001436105706500145225ustar00rootroot00000000000000h5utils-1.13.2/doc/man/h4fromh5.1000066400000000000000000000060041436105706500162400ustar00rootroot00000000000000.\" Copyright (c) 1999-2009 Massachusetts Institute of Technology .\" .\" Permission is hereby granted, free of charge, to any person obtaining .\" a copy of this software and associated documentation files (the .\" "Software"), to deal in the Software without restriction, including .\" without limitation the rights to use, copy, modify, merge, publish, .\" distribute, sublicense, and/or sell copies of the Software, and to .\" permit persons to whom the Software is furnished to do so, subject to .\" the following conditions: .\" .\" The above copyright notice and this permission notice shall be .\" included in all copies or substantial portions of the Software. .\" .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, .\" EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. .\" IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY .\" CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, .\" TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE .\" SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. .\" .TH H4FROMH5 1 "September 2, 2005" "h5utils" "h5utils" .SH NAME h4fromh5 \- convert HDF5 scientific dataset to an HDF4 file .SH SYNOPSIS .B h4fromh5 [\fIOPTION\fR]... [\fIHDF4FILE\fR]... .SH DESCRIPTION .PP ." Add any additional description here h4fromh5 takes one or more files in HDF5 format and outputs files in HDF4 format containing the datasets from the HDF5 files. (Currently, only a single dataset per HDF5 file is converted.) HDF4 and HDF5 are free, portable binary formats and supporting libraries developed by the National Center for Supercomputing Applications at the University of Illinois in Urbana-Champaign. A single .I h5 file can contain multiple data sets; by default, .I h4fromh5 converts the first dataset, but this can be changed via the .B -d option, or by using the syntax \fIHDF5FILE:DATASET\fR. The most basic usage is something like \'h4fromh5 foo.h5\', which will output a file foo.hdf containing the scientific dataset from foo.h5. .SH OPTIONS .TP .B -h Display help on the command-line options and usage. .TP .B -V Print the version number and copyright info for h4fromh5. .TP .B -v Verbose output. .TP .B -T Transpose the output dataset (e.g. LxMxN becomes NxMxL). This is often useful because HDF5 programs typically follow C (row-major) conventions while HDF4 programs often follow Fortran (column-major, transposed) conventions for array ordering. .TP \fB\-o\fR \fIfile\fR Send HDF output to .I file rather than to the input filename with .h5 replaced with .hdf (the default). .TP \fB\-d\fR \fIname\fR Read from dataset .I name in the input; otherwise, the first dataset in the input file is used. Alternatively, use the syntax \fIHDF5FILE:DATASET\fR when the input file names are specified. .SH BUGS Send bug reports to S. G. Johnson, stevenj@alum.mit.edu. .SH AUTHORS Written by Steven G. Johnson. Copyright (c) 2005 by the Massachusetts Institute of Technology. h5utils-1.13.2/doc/man/h5fromh4.1000066400000000000000000000067111436105706500162450ustar00rootroot00000000000000.\" Copyright (c) 1999-2009 Massachusetts Institute of Technology .\" .\" Permission is hereby granted, free of charge, to any person obtaining .\" a copy of this software and associated documentation files (the .\" "Software"), to deal in the Software without restriction, including .\" without limitation the rights to use, copy, modify, merge, publish, .\" distribute, sublicense, and/or sell copies of the Software, and to .\" permit persons to whom the Software is furnished to do so, subject to .\" the following conditions: .\" .\" The above copyright notice and this permission notice shall be .\" included in all copies or substantial portions of the Software. .\" .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, .\" EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. .\" IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY .\" CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, .\" TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE .\" SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. .\" .TH H5FROMH4 1 "March 9, 2002" "h5utils" "h5utils" .SH NAME h5fromh4 \- convert HDF4 scientific datasets to an HDF5 file .SH SYNOPSIS .B h5fromh4 [\fIOPTION\fR]... [\fIHDF4FILE\fR]... .SH DESCRIPTION .PP .\" Add any additional description here h5fromh4 takes one or more files in HDF4 format and outputs files in HDF5 format containing the datasets from the HDF4 files. (Currently, only a single dataset per HDF4 file is converted.) HDF4 and HDF5 are free, portable binary formats and supporting libraries developed by the National Center for Supercomputing Applications at the University of Illinois in Urbana-Champaign. A single .I h5 file can contain multiple data sets; by default, .I h5fromh4 creates a dataset called "data", but this can be changed via the .B -d option, or by using the syntax \fIHDF5FILE:DATASET\fR with the .B -o option. The .B -a option can be used to append new datasets to an existing HDF5 file. If the .B -o option is used and multiple HDF4 files are specified, all the HDF4 datasets are output into that HDF5 file with the input filenames (minus the ".hdf" suffix) used as the dataset names. The most basic usage is something like \'h5fromh4 foo.hdf\', which will output a file foo.h5 containing the scientific dataset from foo.hdf. .SH OPTIONS .TP .B -h Display help on the command-line options and usage. .TP .B -V Print the version number and copyright info for h5fromh4. .TP .B -v Verbose output. .TP .B -a If the HDF5 output file already exists, append the data as a new dataset rather than overwriting the file (the default behavior). An existing dataset of the same name within the file is overwritten, however. .TP \fB\-o\fR \fIfile\fR Send HDF5 output to .I file rather than to the input filename with .hdf replaced with .h5 (the default). If multiple input files were specified, this causes all input datasets to be stored in .I file (rather than in separate files), with the input filenames (minus the .hdf suffix) as the dataset names. .TP \fB\-d\fR \fIname\fR Write to dataset .I name in the output; otherwise, the output dataset is called "data" by default. Alternatively, use the syntax \fIHDF5FILE:DATASET\fR with the .B -o option. .SH BUGS Send bug reports to S. G. Johnson, stevenj@alum.mit.edu. .SH AUTHORS Written by Steven G. Johnson. Copyright (c) 2005 by the Massachusetts Institute of Technology. h5utils-1.13.2/doc/man/h5fromtxt.1000066400000000000000000000100631436105706500165440ustar00rootroot00000000000000.\" Copyright (c) 1999-2009 Massachusetts Institute of Technology .\" .\" Permission is hereby granted, free of charge, to any person obtaining .\" a copy of this software and associated documentation files (the .\" "Software"), to deal in the Software without restriction, including .\" without limitation the rights to use, copy, modify, merge, publish, .\" distribute, sublicense, and/or sell copies of the Software, and to .\" permit persons to whom the Software is furnished to do so, subject to .\" the following conditions: .\" .\" The above copyright notice and this permission notice shall be .\" included in all copies or substantial portions of the Software. .\" .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, .\" EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. .\" IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY .\" CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, .\" TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE .\" SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. .\" .TH H5FROMTXT 1 "March 9, 2002" "h5utils" "h5utils" .SH NAME h5fromtxt \- convert text input to an HDF5 file .SH SYNOPSIS .B h5fromtxt [\fIOPTION\fR]... [\fIHDF5FILE\fR] .SH DESCRIPTION .PP .\" Add any additional description here h5fromtxt takes a series of numbers from standard input and outputs a multi-dimensional numeric dataset in an HDF5 file. HDF5 is a free, portable binary format and supporting library developed by the National Center for Supercomputing Applications at the University of Illinois in Urbana-Champaign. A single .I h5 file can contain multiple data sets; by default, .I h5fromtxt creates a dataset called "data", but this can be changed via the .B -d option, or by using the syntax \fIHDF5FILE:DATASET\fR. The .B -a option can be used to append new datasets to an existing HDF5 file. All characters besides the numbers (and associated decimal points, etcetera) in the input are ignored. By default, the data is assumed to be a two-dimensional MxN dataset where M is the number of rows (delimited by newlines) and N is the number of columns. In this case, it is an error for the number of columns to vary between rows. If M or N is 1 then the data is written as a one-dimensional dataset. Alternatively, you can specify the dimensions of the data explicitly via the .B -n .I size option, where .I size is e.g. "2x2x2". In this case, newlines are ignored and the data is taken as an array of the given size stored in row-major ("C") order (where the last index varies most quickly as you step through the data). e.g. a 2x2x2 array would be have the elements listed in the order: (0,0,0), (0,0,1), (0,1,0), (0,1,1), (1,0,0), (1,0,1), (1,1,0), (1,1,1). A simple example is: .IP "" 4 h5fromtxt foo.h5 < #include #include #include #include "config.h" #include "arrayh5.h" #include "arrayh4.h" #include "copyright.h" #include "h5utils.h" #define CHECK(cond, msg) { if (!(cond)) { fprintf(stderr, "h4fromh5 error: %s\n", msg); exit(EXIT_FAILURE); } } void usage(FILE *f) { fprintf(f, "Usage: h4fromh5 [options] []\n" "Options:\n" " -h : this help message\n" " -V : print version number and copyright\n" " -v : verbose output\n" " -T : transposed output\n" " -o : output to HDF4 file \n" " -d : use dataset in the input file\n" " -- you can also specify a dataset via :\n" ); } int main(int argc, char **argv) { char *h4_fname = NULL; char *data_name = NULL; extern char *optarg; extern int optind; int c; int ifile; int verbose = 0, transpose = 0; while ((c = getopt(argc, argv, "hd:vTo:V")) != -1) switch (c) { case 'h': usage(stdout); return EXIT_SUCCESS; case 'V': printf("h4fromh5 " PACKAGE_VERSION " by Steven G. Johnson\n" COPYRIGHT); return EXIT_SUCCESS; case 'v': verbose = 1; break; case 'T': transpose = 1; break; case 'd': free(data_name); data_name = my_strdup(optarg); break; case 'o': free(h4_fname); h4_fname = my_strdup(optarg); break; default: fprintf(stderr, "Invalid argument -%c\n", c); usage(stderr); return EXIT_FAILURE; } if (optind == argc) { /* no parameters left */ usage(stderr); return EXIT_FAILURE; } if (h4_fname && optind + 1 < argc) { fprintf(stderr, "h4fromh5: only one .h5 file can be used with -o\n"); return EXIT_FAILURE; } for (ifile = optind; ifile < argc; ++ifile) { char *h5_fname, *dname; arrayh4 a4; int i, err; int32 dims_copy[ARRAYH4_MAX_RANK]; char *cur_h4_fname = h4_fname; arrayh5 a; h5_fname = split_fname(argv[ifile], &dname); if (!dname[0]) dname = data_name; if (!cur_h4_fname) cur_h4_fname = replace_suffix(h5_fname, ".h5", ".hdf"); if (verbose) printf("Reading HDF5 input file \"%s\"...\n", h5_fname); err = arrayh5_read(&a, h5_fname, dname, NULL, 0, 0, 0, 0); CHECK(!err, arrayh5_read_strerror[err]); if (transpose) arrayh5_transpose(&a); CHECK(a.rank <= ARRAYH4_MAX_RANK, "HDF5 rank is too big"); for (i = 0; i < a.rank; ++i) dims_copy[i] = a.dims[i]; CHECK(arrayh4_create(&a4, DFNT_FLOAT64, a.rank, dims_copy), "error allocating HDF4 data"); for (i = 0; i < a.N; ++i) a4.p.d[i] = a.data[i]; if (verbose) { double a_min, a_max; arrayh5_getrange(a, &a_min, &a_max); printf("data ranges from %g to %g.\n", a_min, a_max); } if (verbose) { int i; printf("Writing size %d", a.dims[0]); for (i = 1; i < a.rank; ++i) printf("x%d", a.dims[i]); printf(" data to %s\n", cur_h4_fname); } arrayh5_destroy(a); arrayh4_write(cur_h4_fname, a4); arrayh4_destroy(a4); if (h4_fname != cur_h4_fname) free(cur_h4_fname); free(h5_fname); } return EXIT_SUCCESS; } h5utils-1.13.2/h5cyl2cart.c000066400000000000000000000170741436105706500153370ustar00rootroot00000000000000/* Copyright (c) 1999-2023 Massachusetts Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include #include #include #include #include #include "config.h" #include "arrayh5.h" #include "copyright.h" #include "h5utils.h" #define CHECK(cond, msg) { if (!(cond)) { fprintf(stderr, "h5totxt error: %s\n", msg); exit(EXIT_FAILURE); } } void usage(FILE *f) { fprintf(f, "Usage: h5cyl2cart [options] []\n" "Options:\n" " -h : this help message\n" " -V : print version number and copyright\n" " -v : verbose output\n" " -m : for complex data, multiply by exp(i m phi)\n" " -o : output to (first input file only)\n" " -r : radial coordinate starts at (default: 0)\n" " -d : use dataset in the input files (default: first dataset)\n" " -- you can also specify a dataset via :\n" " -- nonzero implies complex data .[ri]\n" " or alternatively -i can be used\n" " -i : imaginary dataset name\n" ); } void cyl2cart(arrayh5 ar, arrayh5 ai, int m, arrayh5 *cr_, arrayh5 *ci_) { arrayh5 cr, ci; int nx,ny,nz,nr, dims[3], ix,iy,iz; double *dcr, *dci, *dar, *dai; nz = ar.rank < 1 ? 1 : ar.dims[0]; nr = ar.rank < 2 ? 1 : ar.dims[1]; nx = ny = 2*nr - 1; dims[0] = nx; dims[1] = ny; dims[2] = nz; *cr_ = cr = arrayh5_create(3, dims); *ci_ = ci = arrayh5_create(3, dims); dcr = cr.data; dci = ci.data; dar = ar.data; dai = ai.data; for (ix = 0; ix < nx; ++ix) for (iy = 0; iy < ny; ++iy) for (iz = 0; iz < nz; ++iz) { double x = ix - (nr - 1); double y = iy - (nr - 1); double p = atan2(y, x), r = sqrt(x*x + y*y); int ir = (int) r; /* round down */ double cm = cos(m*p), sm = sin(m*p); double re, im; if (ir == nr-1 && r-ir < 1e-8) { re = dar[ir*nz+iz]; im = dai[ir*nz+iz]; } else if (ir >= nr-1) { /* r is outside the a array */ re = im = 0.0; } else { /* linearly interpolate between ir and ir+1 */ double dr = r - ir; re = dar[ir+nr*iz]*(1-dr) + dr*dar[(ir+1)+nr*iz]; im = dai[ir+nr*iz]*(1-dr) + dr*dai[(ir+1)+nr*iz]; } /* (re + i*im) * (cm + i*sm) */ dcr[(ix*ny+iy)*nz+iz] = re*cm - im*sm; dci[(ix*ny+iy)*nz+iz] = re*sm + im*cm; } } int main(int argc, char **argv) { arrayh5 ar, ai, cr, ci; char *out_fname = NULL, *data_name = NULL, *data_name_i = NULL; extern char *optarg; extern int optind; int c; int err; int verbose = 0; int m = 0; int ifile; while ((c = getopt(argc, argv, "hVvm:o:r:d:i:")) != -1) switch (c) { case 'h': usage(stdout); return EXIT_SUCCESS; case 'V': printf("h5cyl2cart " PACKAGE_VERSION " by Steven G. Johnson\n" COPYRIGHT); return EXIT_SUCCESS; case 'v': verbose = 1; break; case 'm': m = atoi(optarg); break; case 'o': free(out_fname); out_fname = my_strdup(optarg); break; case 'd': free(data_name); data_name = my_strdup(optarg); break; case 'i': free(data_name_i); data_name_i = my_strdup(optarg); break; default: fprintf(stderr, "Invalid argument -%c\n", c); usage(stderr); return EXIT_FAILURE; } if (optind == argc) { /* no parameters left */ usage(stderr); return EXIT_FAILURE; } for (ifile = optind; ifile < argc; ++ifile) { short append_data = 0; char *dname, *dnamei, *h5_fname; h5_fname = split_fname(argv[ifile], &dname); if (!dname[0]) dname = data_name; if (dname && !dname[0]) dname = NULL; if (dname && m != 0 && !data_name_i) { /* append ".r" if needed */ size_t len = strlen(dname); if (dname[len-2] != '.' || (dname[len-1] != 'r' && dname[len-1] != 'i')) { char *tmp = (char*) malloc(sizeof(char) * (len+3)); strcpy(tmp, dname); strcat(tmp, ".r"); dname = tmp; } else { dname = my_strdup(dname); if (dname[len-1] == 'i') dname[len-1] = 'r'; /* read real part first */ } } else if (dname) dname = my_strdup(dname); read_ar: if (verbose) printf("reading from %s in \"%s\"\n", dname?dname:"?",h5_fname); err = arrayh5_read(&ar, h5_fname, dname, &dnamei, 0, NULL, NULL, NULL); if (!dname) { dname = strdup(dnamei); if (verbose) printf("found dataset %s\n", dname); if (!data_name_i && m != 0) { size_t len = strlen(dname); if (dname[len-2] == '.' && dname[len-1] == 'i') { dname[len-1] = 'r'; goto read_ar; } } } CHECK(!err, arrayh5_read_strerror[err]); CHECK(ar.rank <= 2, "input data must be < 3 dimensional"); if (m == 0) ai = arrayh5_clone(ar); else { if (data_name_i) { free(dnamei); dnamei = strdup(data_name_i); } else { size_t len = strlen(dnamei); CHECK(len >= 2 && dnamei[len-2] == '.' && dnamei[len-1] == 'r', "require .r and .i datanames for nonzero m"); dnamei[len-1] = 'i'; } if (verbose) printf("reading from %s in \"%s\"\n", dnamei, h5_fname); err = arrayh5_read(&ai, h5_fname, dnamei, NULL, 0, NULL, NULL, NULL); CHECK(!err, arrayh5_read_strerror[err]); CHECK(arrayh5_conformant(ar, ai), "real and imaginary data sets must be the same size"); } if (!out_fname) { char *tmp; out_fname = strdup(h5_fname); append_data = 1; tmp = (char*) malloc(sizeof(char) * (strlen(dname)+6)); strcpy(tmp, "cart-"); strcat(tmp, dname); free(dname); dname = tmp; tmp = (char*) malloc(sizeof(char) * (strlen(dnamei)+6)); strcpy(tmp, "cart-"); strcat(tmp, dnamei); free(dnamei); dnamei = tmp; } cyl2cart(ar, ai, m, &cr, &ci); if (verbose) printf("writing %s from %dx%d input data.\n", out_fname, (cr.dims[0]+1)/2, cr.dims[2]); arrayh5_write(cr, out_fname, dname, append_data); if (m != 0) arrayh5_write(ci, out_fname, dnamei, 1); arrayh5_destroy(ar); arrayh5_destroy(ai); arrayh5_destroy(cr); arrayh5_destroy(ci); free(h5_fname); free(out_fname); out_fname = NULL; free(dname); free(dnamei); } free(data_name); free(data_name_i); return EXIT_SUCCESS; } h5utils-1.13.2/h5fromh4.c000066400000000000000000000117631436105706500150120ustar00rootroot00000000000000/* Copyright (c) 1999-2023 Massachusetts Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include #include #include #include #include "config.h" #include "arrayh5.h" #include "arrayh4.h" #include "copyright.h" #include "h5utils.h" #define CHECK(cond, msg) { if (!(cond)) { fprintf(stderr, "h5fromh4 error: %s\n", msg); exit(EXIT_FAILURE); } } void usage(FILE *f) { fprintf(f, "Usage: h5fromh4 [options] []\n" "Options:\n" " -h : this help message\n" " -V : print version number and copyright\n" " -v : verbose output\n" " -o : output to HDF5 file \n" " -a : append to existing hdf5 file\n" " -d : use dataset in the output file (default: \"data\")\n" " -- you can also specify a dataset via :\n" ); } int main(int argc, char **argv) { char *dname, *h5_fname = NULL; char *data_name = NULL; extern char *optarg; extern int optind; int c; int ifile; int verbose = 0; int append = 0; while ((c = getopt(argc, argv, "hd:vo:aV")) != -1) switch (c) { case 'h': usage(stdout); return EXIT_SUCCESS; case 'V': printf("h5fromh4 " PACKAGE_VERSION " by Steven G. Johnson\n" COPYRIGHT); return EXIT_SUCCESS; case 'v': verbose = 1; break; case 'a': append = 1; break; case 'd': free(data_name); data_name = my_strdup(optarg); break; case 'o': free(h5_fname); h5_fname = split_fname(optarg, &dname); if (dname[0]) { free(data_name); data_name = dname; } break; default: fprintf(stderr, "Invalid argument -%c\n", c); usage(stderr); return EXIT_FAILURE; } if (optind == argc) { /* no parameters left */ usage(stderr); return EXIT_FAILURE; } for (ifile = optind; ifile < argc; ++ifile) { char *h4_fname = argv[ifile]; arrayh4 a4; int i, dims_copy[ARRAYH4_MAX_RANK]; char *cur_h5_fname = h5_fname; arrayh5 a; if (!cur_h5_fname) cur_h5_fname = replace_suffix(h4_fname, ".hdf", ".h5"); /* If we specified -o (to concatenate several HDF4 files into a single HDF5 file) and if there is more than one filename argument, use the filename (minus ".hdf") as the dataset name. */ if (h5_fname && optind + 1 < argc) { dname = my_strdup(h4_fname); /* remove ".hdf" from dataset name: */ if (strlen(dname) >= strlen(".hdf") && !strcmp(dname + strlen(dname)-strlen(".hdf"), ".hdf")) dname[strlen(dname) - strlen(".hdf")] = 0; } else { dname = data_name; if (!dname) dname = my_strdup("data"); } if (verbose) printf("Reading HDF4 input file \"%s\"...\n", h4_fname); CHECK(arrayh4_read(h4_fname, &a4, 0), "error reading HDF4 file"); for (i = 0; i < a4.rank; ++i) dims_copy[i] = a4.dims[i]; a = arrayh5_create(a4.rank, dims_copy); if (a4.numtype == DFNT_FLOAT64) { for (i = 0; i < a4.N; ++i) a.data[i] = a4.p.d[i]; } else if (a4.numtype == DFNT_FLOAT32) { for (i = 0; i < a4.N; ++i) a.data[i] = a4.p.f[i]; } else { CHECK(0, "unknown HDF4 numeric type"); } arrayh4_destroy(a4); if (verbose) { double a_min, a_max; arrayh5_getrange(a, &a_min, &a_max); printf("data ranges from %g to %g.\n", a_min, a_max); } if (verbose) { int i; printf("Writing size %d", a.dims[0]); for (i = 1; i < a.rank; ++i) printf("x%d", a.dims[i]); printf(" data to %s:%s\n", cur_h5_fname, dname); } arrayh5_write(a, cur_h5_fname, dname, append || (h5_fname && ifile > optind)); arrayh5_destroy(a); if (h5_fname != cur_h5_fname) free(cur_h5_fname); if (dname != data_name) free(dname); } return EXIT_SUCCESS; } h5utils-1.13.2/h5fromtxt.c000066400000000000000000000143051436105706500153110ustar00rootroot00000000000000/* Copyright (c) 1999-2023 Massachusetts Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include #include #include #include #include #include "config.h" #include "arrayh5.h" #include "copyright.h" #include "h5utils.h" #define CHECK(cond, msg) { if (!(cond)) { fprintf(stderr, "h5fromtxt error: %s\n", msg); exit(EXIT_FAILURE); } } void usage(FILE *f) { fprintf(f, "Usage: h5fromtxt [options] \n" "Options:\n" " -h : this help message\n" " -V : print version number and copyright\n" " -v : verbose output\n" " -a : append to existing hdf5 file\n" " -n : input row-major array dimensions [ default: guessed ]\n" " -T : transpose the data [default: no]\n" " -d : use dataset in the output file (default: \"data\")\n" " -- you can also specify a dataset via :\n" ); } #define MAX_RANK 10 int main(int argc, char **argv) { arrayh5 a; char *dname, *h5_fname; char *data_name = NULL; extern char *optarg; extern int optind; int c; double *data; int idata = 0; int rank = -1, dims[MAX_RANK], N = 1, nrows = 0; int ncols = -1, cur_ncols = 0; int read_newline = 0; int verbose = 0; int transpose = 0; int append = 0; while ((c = getopt(argc, argv, "hn:d:vTaV")) != -1) switch (c) { case 'h': usage(stdout); return EXIT_SUCCESS; case 'V': printf("h5fromtxt " PACKAGE_VERSION " by Steven G. Johnson\n" COPYRIGHT); return EXIT_SUCCESS; case 'v': verbose = 1; break; case 'a': append = 1; break; case 'T': transpose = 1; break; case 'd': free(data_name); data_name = my_strdup(optarg); break; case 'n': { int pos = 0; rank = 0; N = 1; while (isdigit(optarg[pos])) { CHECK(rank < MAX_RANK, "Rank too big in -n argument!\n"); dims[rank] = 0; while (isdigit(optarg[pos])) { dims[rank] = dims[rank]*10 + optarg[pos]-'0'; ++pos; } N *= dims[rank]; ++rank; if (optarg[pos] == 'x' || optarg[pos] == 'X' || optarg[pos] == '*') ++pos; } CHECK(rank > 0 && !optarg[pos], "Invalid -n argument; should be e.g. 23x34 or 10x10x10\n"); break; } default: fprintf(stderr, "Invalid argument -%c\n", c); usage(stderr); return EXIT_FAILURE; } if (optind + 1 != argc) { /* should be exactly 1 parameter left */ usage(stderr); return EXIT_FAILURE; } h5_fname = split_fname(argv[optind], &dname); if (!dname[0]) dname = data_name; if (!dname) dname = my_strdup("data"); data = (double *) malloc(sizeof(double) * N); CHECK(data, "out of memory"); while (!feof(stdin)) { read_newline = 0; /* eat leading spaces */ while (isspace(c = getc(stdin))); ungetc(c, stdin); if (c == EOF) break; /* increase the size of the data array, if necessary */ if (idata >= N) { CHECK(rank < 0, "more inputs in file than specified by -n"); N *= 2; data = (double *) realloc(data, sizeof(double) * N); CHECK(data, "out of memory"); } CHECK(scanf("%lg", &data[idata++]) == 1, "error reading numeric input"); ++cur_ncols; /* eat characters until the next number: */ do { c = getc(stdin); if (c == '\n') read_newline = 1; } while (!(isdigit(c) || c == '.' || c == '-' || c == '+' || c == EOF)); ungetc(c, stdin); if (read_newline) { ++nrows; if (rank < 0) { /* we're trying to guess the input dims */ CHECK(ncols < 0 || cur_ncols == ncols, "the number of input columns is not constant."); } ncols = cur_ncols; cur_ncols = 0; } } if (!read_newline) { /* don't require a newline on the last line */ ++nrows; if (rank < 0) { /* we're trying to guess the input dims */ CHECK(ncols < 0 || cur_ncols == ncols, "the number of input columns is not constant."); } } CHECK(idata > 0, "no inputs read"); if (verbose) printf("Read %d numbers in %d rows.\n", idata, nrows); if (rank < 0) { N = idata; CHECK(N % nrows == 0, "each row must have an equal number of columns"); if (nrows == 1 || nrows == N) { rank = 1; dims[0] = N; } else { rank = 2; dims[0] = nrows; dims[1] = N / nrows; } } else { CHECK(idata == N, "number of inputs does not match -n"); } a = arrayh5_create_withdata(rank, dims, data); if (transpose) arrayh5_transpose(&a); if (verbose) { double a_min, a_max; arrayh5_getrange(a, &a_min, &a_max); printf("data ranges from %g to %g.\n", a_min, a_max); } if (verbose) { int i; printf("Writing size %d", a.dims[0]); for (i = 1; i < a.rank; ++i) printf("x%d", a.dims[i]); printf(" data to %s:%s\n", h5_fname, dname); } arrayh5_write(a, h5_fname, dname, append); arrayh5_destroy(a); return EXIT_SUCCESS; } h5utils-1.13.2/h5math.c000066400000000000000000000232541436105706500145420ustar00rootroot00000000000000/* Copyright (c) 1999-2023 Massachusetts Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include #include #include #include #include #include "config.h" #include "arrayh5.h" #include "copyright.h" #include "h5utils.h" #include #define CHECK(cond, msg) { if (!(cond)) { fprintf(stderr, "h5math error: %s\n", msg); exit(EXIT_FAILURE); } } const char default_data_name[] = "h5math"; void usage(FILE *f) { fprintf(f, "Usage: h5math [options] []\n" "Options:\n" " -h : this help message\n" " -V : print version number and copyright\n" " -v : verbose output\n" " -a : append to existing hdf5 file\n" " -n : output array dimensions [ default: from input ]\n" " -f : read expression to evaluate from file [ default: stdin ]\n" " -e : evaluate to output\n" " -x : take x= slice of data\n" " -y : take y= slice of data\n" " -z : take z= slice of data\n" " -t : take t= slice of data's last dimension\n" " -0 : use dataset center as origin for -x/-y/-z\n" " -r : use resolution for xyz coordinate units in expression\n" " -d : use dataset in the input/output files\n" " [ default: first dataset/%s ]\n" " -- you can also specify a dataset via :\n", default_data_name ); } #define MAX_RANK 10 int main(int argc, char **argv) { arrayh5 *a, ao; int i, n; int rank = -1, dims[MAX_RANK]; extern char *optarg; extern int optind; int c; int slicedim[4] = {NO_SLICE_DIM,NO_SLICE_DIM,NO_SLICE_DIM,NO_SLICE_DIM}; int islice[4], center_slice[4] = {0,0,0,0}; int verbose = 0; int append = 0; char *expr_string = 0, *expr_filename = 0; char *data_name = 0; char *out_fname, *out_dname; char **eval_vars; int eval_nvars; char **vars; double *vals; void *evaluator; double res = 1.0; int nx, ny, nz, nt, nr, ix, iy, iz, it, ir; double cx, cy, cz; while ((c = getopt(argc, argv, "hVvan:f:e:x:y:z:t:0d:r:")) != -1) switch (c) { case 'h': usage(stdout); return EXIT_SUCCESS; case 'V': printf("h5totxt " PACKAGE_VERSION " by Steven G. Johnson\n" COPYRIGHT); return EXIT_SUCCESS; case 'v': verbose = 1; break; case 'a': append = 1; break; case 'n': { int pos = 0; rank = 0; while (isdigit(optarg[pos])) { CHECK(rank < MAX_RANK, "Rank too big in -n argument!\n"); dims[rank] = 0; while (isdigit(optarg[pos])) { dims[rank] = dims[rank]*10 + optarg[pos]-'0'; ++pos; } ++rank; if (optarg[pos] == 'x' || optarg[pos] == 'X' || optarg[pos] == '*') ++pos; } CHECK(rank > 0 && !optarg[pos], "Invalid -n argument; should be e.g. 23x34 or 10x10x10\n"); break; } case 'f': free(expr_filename); expr_filename = my_strdup(optarg); break; case 'e': free(expr_string); expr_string = my_strdup(optarg); break; case 'x': islice[0] = atoi(optarg); slicedim[0] = 0; break; case 'y': islice[1] = atoi(optarg); slicedim[1] = 1; break; case 'z': islice[2] = atoi(optarg); slicedim[2] = 2; break; case 't': islice[3] = atoi(optarg); slicedim[3] = LAST_SLICE_DIM; break; case '0': center_slice[0] = center_slice[1] = center_slice[2] = 1; break; case 'r': res = atof(optarg); break; case 'd': free(data_name); data_name = my_strdup(optarg); break; default: fprintf(stderr, "Invalid argument -%c\n", c); usage(stderr); return EXIT_FAILURE; } if (optind == argc) { /* no parameters left */ usage(stderr); return EXIT_FAILURE; } out_fname = split_fname(argv[optind], &out_dname); if (!out_dname[0]) { if (data_name) out_dname = data_name; else out_dname = (char *) default_data_name; } optind++; n = argc - optind; a = (arrayh5 *) malloc(sizeof(arrayh5) * n); CHECK(a, "out of memory"); for (i = 0; i < n; ++i) { int err; char *fname, *dname; fname = split_fname(argv[i + optind], &dname); if (!dname[0]) dname = data_name; err = arrayh5_read(&a[i], fname, dname, NULL, 4, slicedim, islice, center_slice); CHECK(!err, arrayh5_read_strerror[err]); CHECK(!i || arrayh5_conformant(a[i], a[i-1]), "all input arrays must have the same dimensions"); if (verbose) printf("read variable d%d: dataset \"%s\" in file \"%s\"\n", i + 1, dname ? dname : "", fname); free(fname); } if (rank >= 0) { ao = arrayh5_create(rank, dims); CHECK(!n || arrayh5_conformant(ao, a[0]), "-n dimensions must be same as those of input arrays"); } else if (n) ao = arrayh5_clone(a[0]); else CHECK(0, "output size must be specified with -n if no input arrays"); if (verbose) { printf("rank-%d array dimensions: ", ao.rank); if (!ao.rank) printf("1\n"); for (i = 0; i < ao.rank; ++i) printf("%s%d", i ? "x" : "", ao.dims[i]); printf("\n"); } nx = ao.rank >= 1 ? ao.dims[0] : 1; ny = ao.rank >= 2 ? ao.dims[1] : 1; nz = ao.rank >= 3 ? ao.dims[2] : 1; nt = ao.rank >= 4 ? ao.dims[3] : 1; for (nr = 1, i = 4; i < ao.rank; ++i) nr *= ao.dims[i]; cx = center_slice[0] ? (nx - 1) * 0.5 : 0.0; cy = center_slice[1] ? (ny - 1) * 0.5 : 0.0; cz = center_slice[2] ? (nz - 1) * 0.5 : 0.0; vars = (char **) malloc(sizeof(char *) * (n + 4)); CHECK(vars, "out of memory"); vals = (double *) malloc(sizeof(double) * (n + 4)); CHECK(vals, "out of memory"); for (i = 0; i < n; ++i) { vars[i] = my_strdup("dxxxxxxxxxxxx"); #ifdef HAVE_SNPRINTF snprintf(vars[i], 14, "d%d", i + 1); #else sprintf(vars[i], "d%d", i + 1); #endif vals[i] = 0.0; } vars[n+0] = strdup("x"); vals[n+0] = 0.0; vars[n+1] = strdup("y"); vals[n+1] = 0.0; vars[n+2] = strdup("z"); vals[n+2] = 0.0; vars[n+3] = strdup("t"); vals[n+3] = 0.0; if (!expr_string) { char buf[1024] = ""; int len; FILE *f = expr_filename ? fopen(expr_filename, "r") : stdin; CHECK(f, "unable to open expression file"); if (verbose && f == stdin) printf("Enter expression to write to %s:\n", out_fname); fgets(buf, 1024, f); expr_string = my_strdup(buf); len = strlen(buf) + 1; while (fgets(buf, 1024, f)) { len += strlen(buf); expr_string = (char *) realloc(expr_string, len); strcat(expr_string, buf); } for (ix = 0; ix < len; ++ix) if (expr_string[ix] == '\n') expr_string[ix] = ' '; /* matheval chokes on newlines */ if (expr_filename) fclose(f); } CHECK(evaluator = evaluator_create(expr_string), "error parsing symbolic expression"); evaluator_get_variables(evaluator, &eval_vars, &eval_nvars); for (ix = 0; ix < eval_nvars; ++ix) { for (iy = 0; iy < n + 4 && strcmp(eval_vars[ix], vars[iy]); ++iy) ; if (iy == n + 4) { fprintf(stderr, "h5math error: unrecognized variable \"%s\"\n", eval_vars[ix]); exit(EXIT_FAILURE); } } if (verbose) { char *buf = evaluator_get_string(evaluator); printf("Evaluating expression: %s\n", buf); } for (ix = 0; ix < nx; ++ix) for (iy = 0; iy < ny; ++iy) for (iz = 0; iz < nz; ++iz) for (it = 0; it < nt; ++it) for (ir = 0; ir < nr; ++ir) { int idx = ir + nr * (it + nt * (iz + nz * (iy + ny * ix))); for (i = 0; i < n; ++i) vals[i] = a[i].data[idx]; vals[n+0] = (ix - cx) / res; vals[n+1] = (iy - cy) / res; vals[n+2] = (iz - cz) / res; vals[n+3] = ao.rank >= 4 ? it : (ao.rank >= 3 ? iz : (ao.rank >= 2 ? iy : ix)); ao.data[idx] = evaluator_evaluate(evaluator, n+4, vars, vals); } if (verbose) printf("Writing data to \"%s\" in \"%s\"...\n", out_dname ? out_dname : "", out_fname); arrayh5_write(ao, out_fname, out_dname, append); free(vals); for (i = 0; i < n+4; ++i) free(vars[i]); free(vars); arrayh5_destroy(ao); for (i = 0; i < n; ++i) arrayh5_destroy(a[i]); free(a); free(out_fname); free(expr_filename); free(expr_string); free(data_name); return EXIT_SUCCESS; } h5utils-1.13.2/h5read.cc000066400000000000000000000063161436105706500146670ustar00rootroot00000000000000/* Copyright (c) 1999, 2000, 2001, 2002 Massachusetts Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include #include #include #include #include "arrayh5.h" DEFUN_DLD(h5read, args, , "h5read(filename [, slicedim, islice, dataname])\n" "Read a 1d or 2d array slice from an HDF5 file.\n\n" "slicedim and islice are optional parameters indicating a \"slice\" of a\n" "multidimensional dataset, where slicedim is \"x\", \"y\", or \"z\", and\n" "islice is the index in that dimension. The default is slicedim=\"z\" and\n" "islice=0, meaning the xy plane at z index 0 is read.\n\n" "The optional parameter dataname indicates the name of the dataset to read\n" "within the HDF5 file. The default is to read the first dataset.\n" ) { std::string fname, dataname; octave_value retval; arrayh5 a; int readerr; int slicedim = 2, islice = 0, center_slice = 0; if (args.length() < 1 || args.length() > 4 || !args(0).is_string() || (args.length() >= 2 && !args(1).is_string()) || (args.length() >= 3 && !args(2).is_real_scalar()) || (args.length() >= 4 && !args(3).is_string())) { print_usage("h5read"); return retval; } fname = args(0).string_value(); if (args.length() >= 2) slicedim = tolower(*(args(1).string_value().c_str())) - 'x'; if (args.length() >= 3) islice = (int) (args(2).double_value() + 0.5); readerr = arrayh5_read(&a, fname.c_str(), args.length() >= 4 ? args(3).string_value().c_str() : NULL, NULL, 1, &slicedim, &islice, ¢er_slice); if (readerr) { fprintf(stderr, "error in h5read: %s\n", arrayh5_read_strerror[readerr]); return retval; } if (a.rank >= 2) { Matrix m(a.dims[0], a.dims[1]); for (int i = 0; i < a.dims[0]; ++i) for (int j = 0; j < a.dims[1]; ++j) m(i,j) = a.data[i*a.dims[1] + j]; retval = m; } else if (a.rank == 1) { ColumnVector v(a.dims[0]); for (int i = 0; i < a.dims[0]; ++i) v(i) = a.data[i]; retval = v; } else { retval = a.data[0]; /* scalar (rank = 0) */ } arrayh5_destroy(a); return retval; } h5utils-1.13.2/h5topng.c000066400000000000000000000443021436105706500147350ustar00rootroot00000000000000/* Copyright (c) 1999-2023 Massachusetts Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include #include #include #include #include #include #include "config.h" #include "arrayh5.h" #include "copyright.h" #include "writepng.h" #include "h5utils.h" #define CHECK(cond, msg) { if (!(cond)) { fprintf(stderr, "h5topng error: %s\n", msg); exit(EXIT_FAILURE); } } #define CMAP_DEFAULT "gray" #define OVERLAY_CMAP_DEFAULT "yellow" #define OVERLAY_OPACITY_DEFAULT 0.2 #define CMAP_DIR DATADIR "/" PACKAGE_NAME "/colormaps/" #if defined(HAVE_WORDEXP) && defined(HAVE_WORDEXP_H) # include #endif /* shell expansion on a path, used for CMAP_DIR */ char *shell_expand(const char *path) { #if defined(HAVE_WORDEXP) && defined(HAVE_WORDEXP_H) wordexp_t p; char *newpath; wordexp(path, &p, 0); newpath = my_strdup(p.we_wordc == 1 ? p.we_wordv[0] : path); wordfree(&p); return newpath; #else return my_strdup(path); #endif } void usage(FILE *f) { fprintf(f, "Usage: h5topng [options] []\n" "Options:\n" " -h : this help message\n" " -V : print version number and copyright\n" " -v : verbose output\n" " -o : output to (first input file only)\n" " -x : take x= slice of data (or ::)\n" " -y : take y= slice of data\n" " -z : take z= slice of data\n" " -t : take t= slice of data's last dimension\n" " -0 : use dataset center as origin for -x/-y/-z\n" " -X : scale width by [ default: 1.0 ]\n" " -Y : scale height by [ default: 1.0 ]\n" " -S : equivalent to -X -Y \n" " -s : skew axes by degrees [ default: 0 ]\n" " -T : transpose the data [default: no]\n" " -c : use colormap [default: " CMAP_DEFAULT "]\n" " (see " CMAP_DIR " for other colormaps)\n" " -r : reverse color map [default: no]\n" " -Z : center color scale at zero [default: no]\n" " -m : set bottom of color scale to data value \n" " -M : set top of color scale to data value \n" " -R : use uniform colormap range for all files\n" " -C : superimpose contour outlines from \n" " -b : contours around values != [default: 1.0]\n" " -A : overlay data from , as specified by -y\n" " -a :: overlay colormap , opacity (0-1) [default: %s:%g]\n" " -8 : use an 8-bit color table, instead of 24-bit direct color\n" " -d : use dataset in the input files (default: first dataset)\n" " -- you can also specify a dataset via :\n", OVERLAY_CMAP_DEFAULT, OVERLAY_OPACITY_DEFAULT); } rgba_t gray_colors[2] = { {1,1,1,0}, {0,0,0,1} }; colormap_t gray_cmap = { 2, gray_colors }; rgba_t yellow_colors[2] = { {1,1,1,0}, {1,1,0,1} }; colormap_t yellow_cmap = {2, yellow_colors}; static colormap_t load_colormap(FILE *f, int verbose) { colormap_t cmap = {0, NULL}; int nalloc = 0; float r,g,b,a; int c; /* read initial comment lines, and echo if verbose */ do { while (isspace(c = fgetc(f))); if (c == '#' || c == '%') { while (isspace(c = fgetc(f)) && c != '\n' && c != EOF); if (c != EOF) ungetc(c, f); while ('\n' != (c = fgetc(f)) && c != EOF) if (verbose) putchar(c); if (verbose) putchar('\n'); } } while (c == '\n'); if (c != EOF) ungetc(c, f); while (4 == fscanf(f, "%g %g %g %g", &r, &g, &b, &a)) { if (cmap.n >= nalloc) { nalloc = (1 + nalloc) * 2; cmap.rgba = realloc(cmap.rgba, nalloc * sizeof(rgba_t)); CHECK(cmap.rgba, "out of memory"); } cmap.rgba[cmap.n].r = r; cmap.rgba[cmap.n].g = g; cmap.rgba[cmap.n].b = b; cmap.rgba[cmap.n].a = a; cmap.n++; } cmap.rgba = realloc(cmap.rgba, cmap.n * sizeof(rgba_t)); CHECK(cmap.n >= 1, "invalid colormap file"); if (verbose) printf("%d color entries read from colormap file.\n", cmap.n); return cmap; } colormap_t copy_colormap(const colormap_t c0) { colormap_t c; int i; c.n = c0.n; c.rgba = (rgba_t *) malloc(c.n * sizeof(rgba_t)); CHECK(c.rgba, "out of memory"); for (i = 0; i < c.n; ++i) c.rgba[i] = c0.rgba[i]; return c; } colormap_t get_cmap(const char *cmap_dir, const char *colormap, int invert, double scale_alpha, int verbose) { int i; colormap_t cmap = {0, NULL}; FILE *cmap_f = NULL; char *cmap_fname = (char *) malloc(sizeof(char) * (strlen(cmap_dir) + strlen(colormap) + 1)); CHECK(cmap_fname, "out of memory"); if (colormap[0] == '-') { invert = 1; colormap++; } strcpy(cmap_fname, cmap_dir); strcat(cmap_fname, colormap); if (colormap[0] == '.' || colormap[0] == '/' || !(cmap_f = fopen(cmap_fname, "r"))) { free(cmap_fname); cmap_fname = my_strdup(colormap); if (!(cmap_f = fopen(cmap_fname, "r"))) { if (!strcmp(colormap, "gray")) cmap = gray_cmap; if (!strcmp(colormap, "yellow")) cmap = yellow_cmap; else { fprintf(stderr, "Could not find colormap \"%s\"\n", colormap); exit(EXIT_FAILURE); } } } if (cmap.rgba == gray_colors) { if (verbose) printf("Using built-in gray colormap%s.\n", invert ? " (inverted)" : ""); cmap = copy_colormap(cmap); } else if (cmap.rgba == yellow_colors) { if (verbose) printf("Using built-in yellow colormap%s.\n", invert ? " (inverted)" : ""); cmap = copy_colormap(cmap); } else { if (verbose) printf("Using colormap \"%s\" in file \"%s\"%s.\n", colormap, cmap_fname, invert ? " (inverted)" : ""); cmap = load_colormap(cmap_f, verbose); fclose(cmap_f); } free(cmap_fname); if (invert) for (i = 0; i < cmap.n - 1 - i; ++i) { rgba_t rgba = cmap.rgba[i]; cmap.rgba[i] = cmap.rgba[cmap.n - 1 - i]; cmap.rgba[cmap.n - 1 - i] = rgba; } if (verbose) printf("Scaling opacity by %g\n", scale_alpha); for (i = 0; i < cmap.n; ++i) cmap.rgba[i].a *= scale_alpha; return cmap; } static int get_islice(const char *s, int *min, int *max, int *step) { int num_read = sscanf(s, "%d:%d:%d", min, step, max); if (num_read == 1) { *max = *min; *step = 1; } else if (num_read == 2) { *max = *step; *step = 1; } CHECK(num_read, "invalid slice argument"); return num_read; } static int iabs(int x) { return x < 0 ? -x : x; } static int imax(int x, int y) { return x > y ? x : y; } static int ilog10(int x) { int lg = 0, prod = 1; while (prod < x) { ++lg; prod *= 10; } return lg - 1; } int main(int argc, char **argv) { arrayh5 a, contour_data, overlay_data; char *png_fname = NULL, *contour_fname = NULL, *data_name = NULL; char *overlay_fname = NULL; REAL mask_thresh = 0; int mask_thresh_set = 0; double min = 0, max = 0, allmin = 0, allmax = 0; int min_set = 0, max_set = 0, collect_range = 0; extern char *optarg; extern int optind; int c; int slicedim[4] = {NO_SLICE_DIM,NO_SLICE_DIM,NO_SLICE_DIM,NO_SLICE_DIM}; int islice[4], center_slice[4] = {0,0,0,0}; int islice_min[4] = {0,0,0,0}, islice_max[4] = {0,0,0,0}, islice_step[4] = {1,1,1,1}; int err; int nx, ny; char *colormap = NULL, *overlay_colormap = NULL, *cmap_dir = NULL; int overlay_invert = 0; colormap_t cmap = { 0, NULL }; colormap_t overlay_cmap = { 0, NULL }; double overlay_opacity = OVERLAY_OPACITY_DEFAULT; int verbose = 0; int transpose = 0; int zero_center = 0; double scalex = 1.0, scaley = 1.0; int invert = 0; double skew = 0.0; int eight_bit = 0; int ifile, num_processed; int data_rank, slicedim3; colormap = my_strdup(CMAP_DEFAULT); overlay_colormap = my_strdup(OVERLAY_CMAP_DEFAULT); /* do tilde and $foo expansion on CMAP_DIR */ cmap_dir = shell_expand(CMAP_DIR); while ((c = getopt(argc, argv, "ho:x:y:z:t:0c:m:M:RC:b:d:vX:Y:S:TrZs:Va:A:8")) != -1) switch (c) { case 'h': usage(stdout); return EXIT_SUCCESS; case 'V': printf("h5topng " PACKAGE_VERSION " by Steven G. Johnson\n" COPYRIGHT); return EXIT_SUCCESS; case 'v': verbose = 1; break; case 'T': transpose = 1; break; case 'r': invert = 1; break; case '8': eight_bit = 1; break; case 'Z': zero_center = 1; break; case 'R': collect_range = 1; break; case 'o': free(png_fname); png_fname = my_strdup(optarg); break; case 'd': free(data_name); data_name = my_strdup(optarg); break; case 'C': free(contour_fname); contour_fname = my_strdup(optarg); break; case 'A': free(overlay_fname); overlay_fname = my_strdup(optarg); break; case 'x': get_islice(optarg, &islice_min[0], &islice_max[0], &islice_step[0]); slicedim[0] = 0; break; case 'y': get_islice(optarg, &islice_min[1], &islice_max[1], &islice_step[1]); slicedim[1] = 1; break; case 'z': get_islice(optarg, &islice_min[2], &islice_max[2], &islice_step[2]); slicedim[2] = 2; break; case 't': get_islice(optarg, &islice_min[3], &islice_max[3], &islice_step[3]); slicedim[3] = LAST_SLICE_DIM; break; case '0': center_slice[0] = center_slice[1] = center_slice[2] = 1; break; case 'c': free(colormap); colormap = my_strdup(optarg); break; case 'a': free(overlay_colormap); overlay_colormap = my_strdup(optarg); if (strchr(optarg, ':')) { *(strchr(overlay_colormap, ':')) = 0; sscanf(strchr(optarg, ':')+1, "%lg", &overlay_opacity); CHECK(overlay_opacity >= 0 && overlay_opacity <= 1, "invalid opacity in -a: must be from 0 to 1"); } break; case 'm': min = atof(optarg); min_set = 1; break; case 'M': max = atof(optarg); max_set = 1; break; case 'b': mask_thresh = atof(optarg); mask_thresh_set = 1; break; case 'X': scalex = atof(optarg); break; case 'Y': scaley = atof(optarg); break; case 'S': scalex = scaley = atof(optarg); break; case 's': skew = atof(optarg) * 3.14159265358979323846 / 180.0; break; default: fprintf(stderr, "Invalid argument -%c\n", c); usage(stderr); return EXIT_FAILURE; } CHECK(!overlay_fname || !eight_bit, "-8 option is not currently supported with -A"); cmap = get_cmap(cmap_dir, colormap, invert, 1.0, verbose); if (overlay_fname) overlay_cmap = get_cmap(cmap_dir, overlay_colormap, overlay_invert, overlay_opacity, verbose); if (optind == argc) { /* no parameters left */ usage(stderr); return EXIT_FAILURE; } contour_data.data = overlay_data.data = NULL; slicedim3 = slicedim[3]; { char *dname, *h5_fname; h5_fname = split_fname(argv[optind], &dname); if (!dname[0]) dname = data_name; err = arrayh5_read_rank(h5_fname, dname, &data_rank); CHECK(!err, arrayh5_read_strerror[err]); free(h5_fname); if (verbose) printf("data rank = %d\n", data_rank); } process_files: num_processed = 0; for (islice[0] = islice_min[0]; islice[0] <= islice_max[0]; islice[0] += islice_step[0]) for (islice[1] = islice_min[1]; islice[1] <= islice_max[1]; islice[1] += islice_step[1]) for (islice[2] = islice_min[2]; islice[2] <= islice_max[2]; islice[2] += islice_step[2]) for (islice[3] = islice_min[3]; islice[3] <= islice_max[3]; islice[3] += islice_step[3]) { int onx = 1, ony = 1; int cnx = 1, cny = 1; if (contour_fname && !collect_range) { int rank; char *fname, *dname; fname = split_fname(contour_fname, &dname); if (!dname[0]) dname = NULL; if (verbose) printf("reading contour data from \"%s\".\n", fname); err = arrayh5_read_rank(fname, dname, &rank); CHECK(!err, arrayh5_read_strerror[err]); if (slicedim3 == LAST_SLICE_DIM && data_rank > rank) slicedim[3] = NO_SLICE_DIM; err = arrayh5_read(&contour_data, fname, dname, NULL, 4, slicedim, islice, center_slice); slicedim[3] = slicedim3; CHECK(!err, arrayh5_read_strerror[err]); CHECK(contour_data.rank == 1 || contour_data.rank == 2, "contour slice must be one or two dimensional"); cnx = contour_data.dims[0]; cny = contour_data.rank >= 2 ? contour_data.dims[1] : 1; if (!mask_thresh_set) { double c_min, c_max; arrayh5_getrange(contour_data, &c_min, &c_max); mask_thresh = (c_min + c_max) * 0.5; } free(fname); } if (overlay_fname && !collect_range) { int rank; char *fname, *dname; fname = split_fname(overlay_fname, &dname); if (!dname[0]) dname = NULL; if (verbose) printf("reading overlay data from \"%s\".\n", fname); err = arrayh5_read_rank(fname, dname, &rank); CHECK(!err, arrayh5_read_strerror[err]); if (slicedim3 == LAST_SLICE_DIM && data_rank > rank) slicedim[3] = NO_SLICE_DIM; err = arrayh5_read(&overlay_data, fname, dname, NULL, 4, slicedim, islice, center_slice); slicedim[3] = slicedim3; CHECK(!err, arrayh5_read_strerror[err]); CHECK(overlay_data.rank == 1 || overlay_data.rank == 2, "overlay slice must be one or two dimensional"); onx = overlay_data.dims[0]; ony = overlay_data.rank >= 2 ? overlay_data.dims[1] : 1; free(fname); } if (verbose) printf("------\n"); for (ifile = optind; ifile < argc; ++ifile) { char *dname, *h5_fname; h5_fname = split_fname(argv[ifile], &dname); if (!dname[0]) dname = data_name; if (verbose) { int i; printf("reading from \"%s\"", h5_fname); for (i = 0; i < 4; ++i) if (slicedim[i] != NO_SLICE_DIM) printf(", slice at %d in %c dimension", islice[i], slicedim[i] == LAST_SLICE_DIM ? 't' : slicedim[i] + 'x'); printf(".\n"); } err = arrayh5_read(&a, h5_fname, dname, NULL, 4, slicedim, islice, center_slice); CHECK(!err, arrayh5_read_strerror[err]); CHECK(a.rank >= 1, "data must have at least one dimension"); CHECK(a.rank <= 2, "data can have at most two dimensions (try specifying a slice)"); if (!png_fname) { char dimname[] = "xyzt", suff[1024] = ""; int dim; for (dim = 0; dim < 4; ++dim) if (islice_max[dim] >= islice_min[dim]+islice_step[dim]) { char s[128]; sprintf(s, ".%c%0*d", dimname[dim], 1 + ilog10(imax(iabs(islice_min[dim]), iabs(islice_max[dim]))), islice[dim]); strcat(suff, s); } strcat(suff, ".png"); png_fname = replace_suffix(h5_fname, ".h5", suff); } { double a_min, a_max; arrayh5_getrange(a, &a_min, &a_max); if (verbose) printf("data ranges from %g to %g.\n", a_min, a_max); if (!min_set) min = a_min; if (!max_set) max = a_max; if (!num_processed || a_min < allmin) allmin = a_min; if (!num_processed || a_max > allmax) allmax = a_max; if (min > max) { a_min = min; min = max; max = a_min; } if (zero_center) { if (!max_set || min_set || max <= 0) max = fabs(max) > fabs(min) ? fabs(max) : fabs(min); min = -max; } } if (!collect_range) { nx = a.dims[0]; ny = a.rank < 2 ? 1 : a.dims[1]; if (verbose) printf("writing \"%s\" from %dx%d input data.\n", png_fname, nx, ny); writepng(png_fname, nx, ny, !transpose, skew, scaley, scalex, a.data, contour_fname ? contour_data.data : NULL, mask_thresh, cnx, cny, overlay_fname ? overlay_data.data : NULL,overlay_cmap, onx, ony, min, max, cmap, eight_bit); } arrayh5_destroy(a); free(png_fname); png_fname = NULL; free(h5_fname); ++num_processed; } if (contour_data.data) arrayh5_destroy(contour_data); if (overlay_data.data) arrayh5_destroy(overlay_data); contour_data.data = overlay_data.data = NULL; } /* islice loop */ if (verbose && num_processed) printf("all data range from %g to %g.\n", allmin, allmax); if (collect_range) { if (!min_set) min = allmin; if (!max_set) max = allmax; min_set = max_set = 1; collect_range = 0; goto process_files; } free(contour_fname); free(overlay_fname); free(data_name); if (cmap.rgba != gray_colors) free(cmap.rgba); free(colormap); free(cmap_dir); return EXIT_SUCCESS; } h5utils-1.13.2/h5totxt.c000066400000000000000000000150541436105706500147720ustar00rootroot00000000000000/* Copyright (c) 1999-2023 Massachusetts Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include #include #include #include #include "config.h" #include "arrayh5.h" #include "copyright.h" #include "h5utils.h" #define CHECK(cond, msg) { if (!(cond)) { fprintf(stderr, "h5totxt error: %s\n", msg); exit(EXIT_FAILURE); } } void usage(FILE *f) { fprintf(f, "Usage: h5totxt [options] []\n" "Options:\n" " -h : this help message\n" " -V : print version number and copyright\n" " -v : verbose output\n" " -s : use to separate columns [ default: \",\" ]\n" " -o : output to (first input file only)\n" " -x : take x= slice of data\n" " -y : take y= slice of data\n" " -z : take z= slice of data\n" " -t : take t= slice of data's last dimension\n" " -0 : use dataset center as origin for -x/-y/-z\n" " -T : transpose the data [default: no]\n" " -. : output decimal places [ default: 16 ]\n" " -d : use dataset in the input files (default: first dataset)\n" " -- you can also specify a dataset via :\n" ); } int main(int argc, char **argv) { arrayh5 a; char *txt_fname = NULL, *data_name = NULL; extern char *optarg; extern int optind; int c; int slicedim[4] = {NO_SLICE_DIM,NO_SLICE_DIM,NO_SLICE_DIM,NO_SLICE_DIM}; int islice[4], center_slice[4] = {0,0,0,0}; int err; int nx, ny, nz; int dec = 16; int verbose = 0; int transpose = 0; char *sep; int ifile; sep = my_strdup(","); while ((c = getopt(argc, argv, "ho:x:y:z:t:0ad:vTs:.:V")) != -1) switch (c) { case 'h': usage(stdout); return EXIT_SUCCESS; case 'V': printf("h5totxt " PACKAGE_VERSION " by Steven G. Johnson\n" COPYRIGHT); return EXIT_SUCCESS; case 'v': verbose = 1; break; case '0': center_slice[0] = center_slice[1] = center_slice[2] = 1; break; case 'T': transpose = 1; break; case 'o': free(txt_fname); txt_fname = my_strdup(optarg); break; case 's': free(sep); sep = my_strdup(optarg); break; case 'd': free(data_name); data_name = my_strdup(optarg); break; case '.': dec = atoi(optarg); break; case 'x': islice[0] = atoi(optarg); slicedim[0] = 0; break; case 'y': islice[1] = atoi(optarg); slicedim[1] = 1; break; case 'z': islice[2] = atoi(optarg); slicedim[2] = 2; break; case 't': islice[3] = atoi(optarg); slicedim[3] = LAST_SLICE_DIM; break; case 'a': slicedim[0] = slicedim[1] = slicedim[2] = slicedim[3] = NO_SLICE_DIM; break; default: fprintf(stderr, "Invalid argument -%c\n", c); usage(stderr); return EXIT_FAILURE; } if (optind == argc) { /* no parameters left */ usage(stderr); return EXIT_FAILURE; } for (ifile = optind; ifile < argc; ++ifile) { char *dname, *h5_fname; h5_fname = split_fname(argv[ifile], &dname); if (!dname[0]) dname = data_name; if (verbose) { int i; printf("reading from \"%s\"", h5_fname); for (i = 0; i < 4; ++i) if (slicedim[i] != NO_SLICE_DIM) printf(", slice at %d in %c dimension", islice[i], slicedim[i] == LAST_SLICE_DIM ? 't' : slicedim[i] + 'x'); printf(".\n"); } err = arrayh5_read(&a, h5_fname, dname, NULL, 4, slicedim, islice, center_slice); CHECK(!err, arrayh5_read_strerror[err]); if (transpose) arrayh5_transpose(&a); { double a_min, a_max; arrayh5_getrange(a, &a_min, &a_max); if (verbose) printf("data ranges from %.*g to %.*g.\n", dec, a_min, dec, a_max); } nx = a.rank < 1 ? 1 : a.dims[0]; ny = a.rank < 2 ? 1 : a.dims[1]; nz = a.rank < 3 ? 1 : a.dims[2]; if (verbose && a.rank <= 3) printf("writing %s from %dx%dx%d input data.\n", txt_fname ? txt_fname : "to stdout", nx, ny, nz); { FILE *f; int i, j, k; if (txt_fname) { f = fopen(txt_fname, "w"); CHECK(f, "error creating file"); } else f = stdout; if (a.rank < 3) for (i = 0; i < nx; ++i) { if (ny > 0) fprintf(f, "%.*g", dec, a.data[i*ny + 0]); for (j = 1; j < ny; ++j) fprintf(f, "%s%.*g", sep, dec, a.data[i*ny + j]); fprintf(f, "\n"); } else if (a.rank == 3) for (i = 0; i < nx; ++i) { if (i > 0) fprintf(f, "\n"); for (j = 0; j < ny; ++j) { int ij = nz * (ny * i + j); if (nz > 0) fprintf(f, "%.*g", dec, a.data[ij + 0]); for (k = 1; k < nz; ++k) fprintf(f, "%s%.*g", sep, dec, a.data[ij + k]); fprintf(f, "\n"); } } else { if (a.N > 0) fprintf(f, "%.*g", dec, a.data[0]); for (i = 0; i < a.N; ++i) { fprintf(f, "%s%.*g", sep, dec, a.data[i]); } fprintf(f, "\n"); } if (txt_fname) fclose(f); } arrayh5_destroy(a); if (txt_fname) free(txt_fname); txt_fname = NULL; free(h5_fname); } free(sep); free(data_name); return EXIT_SUCCESS; } h5utils-1.13.2/h5tov5d.c000066400000000000000000000312011436105706500146410ustar00rootroot00000000000000/* Copyright (c) 1999-2023 Massachusetts Institute of Technology * * [ IMPORTANT: Note that the following is DIFFERENT from the license * for the rest of the h5utils package. ] * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include #include #include #include #include "config.h" #include "arrayh5.h" #include "h5utils.h" /* Vis5d header files: */ #if defined(HAVE_VIS5Dp_V5D_H) # include #elif defined(HAVE_VIS5D_V5D_H) # include #else # include #endif #define CHECK(cond, msg) { if (!(cond)) { fprintf(stderr, "h5tov5d error: %s\n", msg); exit(EXIT_FAILURE); } } void usage(FILE *f) { fprintf(f, "Usage: h5tov5d [options] []\n" "Options:\n" " -h : this help message\n" " -V : print version number and copyright\n" " -v : verbose output\n" " -T : transposed output dimensions\n" " -x : take x= slice of data\n" " -y : take y= slice of data\n" " -z : take z= slice of data\n" " -t : take t= slice of data's last dimension\n" " -0 : use dataset center as origin for -x/-y/-z\n" " -o : output datasets from all input files to \n" " -1,-2,-4 : number of bytes per data point to use in output (default: 1)\n" " (fewer bytes is faster, but has less resolution)\n" " -d : use dataset in the input files (default: first dataset)\n" " -- you can also specify a dataset via :\n" ); } /* The following routine was adapted from convert/foo2_to_v5d.c from Vis5D 4.2, which is Copyright (C) 1990-1997 Bill Hibbard, Johan Kellum, Brian Paul, Dave Santek, and Andre Battaiola, and is distributed under the GNU General Public License. */ void output_v5d(char *v5d_fname, char *data_label, int nslicedim, const int *slicedim, const int *islice, const int *center_slice, int store_bytes, int transpose, char **h5_fnames, int num_h5, int join) { char *data_name; char *fname; arrayh5 a; int it, iv, firstdim, ifile; float *g = 0; /** Parameters to v5dCreate: */ int NumTimes; /* number of time steps */ int NumVars; /* number of variables */ int Nr, Nc, Nl[MAXVARS]; /* size of 3-D grids */ char VarName[MAXVARS][10]; /* names of variables */ int TimeStamp[MAXTIMES]; /* real times for each time step */ int DateStamp[MAXTIMES]; /* real dates for each time step */ int CompressMode; /* number of bytes per grid */ int Projection; /* a projection number */ float ProjArgs[100]; /* the projection parameters */ int Vertical; /* a vertical coord system number */ float VertArgs[MAXLEVELS]; /* the vertical coord sys parameters */ if (num_h5 <= 0) return; for (ifile = 0; ifile < num_h5; ++ifile) { int err; fname = split_fname(h5_fnames[ifile], &data_name); if (!data_name[0]) data_name = data_label; err = arrayh5_read(&a, fname, data_name, NULL, nslicedim, slicedim, islice, center_slice); free(fname); CHECK(!err, arrayh5_read_strerror[err]); CHECK(a.rank >= 1, "data must have at least one dimension"); CHECK(a.rank <= 5, "data cannot have more than 5 dimensions"); /* if the data is 4 dimensional, express that by using different times and/or variables */ NumTimes = a.rank < 4 ? 1 : a.dims[a.rank - 1]; CHECK(NumTimes <= MAXTIMES, "too many time steps"); firstdim = a.rank <= 4 ? 0 : a.rank - 4; /* If the data is 5 dimensional, express that by using different variables. Alternatively, if we are joining, the different variables are the different files; in that case, the data cannot be 5d. */ NumVars = a.rank < 5 ? 1 : a.dims[0]; if (join) { CHECK(NumVars == 1, "cannot join 5d datasets"); NumVars = num_h5; } CHECK(NumVars <= MAXVARS, "too many vars"); if (!transpose) { /* we will need to transpose the data, since HDF5 gives us the data in row-major order, while Vis5D expects it in column-major order (we could avoid physically transposing the data by passing Vis5d transposed dimensions, but that seems ugly). */ Nr = firstdim >= a.rank ? 1 : a.dims[firstdim]; Nc = firstdim+1 >= a.rank ? 1 : a.dims[firstdim+1]; Nl[0] = firstdim+2 >= a.rank ? 1 : a.dims[firstdim+2]; } else { Nr = firstdim+2 >= a.rank ? 1 : a.dims[firstdim+2]; Nc = firstdim+1 >= a.rank ? 1 : a.dims[firstdim+1]; Nl[0] = firstdim >= a.rank ? 1 : a.dims[firstdim]; } if (!v5d_fname) { fname = split_fname(h5_fnames[ifile], &data_name); v5d_fname = replace_suffix(fname, ".h5", ".v5d"); free(fname); } if (join && ifile == 0) { arrayh5_destroy(a); /* destroy while we check other datasets */ /* loop to assign VarName[] and Nl[] arrays: */ for (iv = 0; iv < NumVars; ++iv) { char *name; int numTimes, nr, nc, fdim; fname = split_fname(h5_fnames[iv], &data_name); name = replace_suffix(fname, ".h5", data_name[0] ? data_name - 1 : ""); if (!data_name[0]) data_name = data_label; for (it = 0; it < 9 && name[it]; ++it) VarName[iv][it] = name[it]; VarName[iv][it] = 0; free(name); /* we don't really have to read the whole array; if we called HDF5 routines directly, we could just get the dimensions...oh well */ err = arrayh5_read(&a, fname, data_name, NULL, nslicedim, slicedim, islice, center_slice); CHECK(!err, arrayh5_read_strerror[err]); free(fname); numTimes = a.rank < 4 ? 1 : a.dims[a.rank - 1]; fdim = a.rank <= 4 ? 0 : a.rank - 4; if (!transpose) { nr = fdim >= a.rank ? 1 : a.dims[fdim]; nc = fdim+1 >= a.rank ? 1 : a.dims[fdim+1]; Nl[iv] = fdim+2 >= a.rank ? 1 : a.dims[fdim+2]; } else { nr = fdim+2 >= a.rank ? 1 : a.dims[fdim+2]; nc = fdim+1 >= a.rank ? 1 : a.dims[fdim+1]; Nl[iv] = fdim >= a.rank ? 1 : a.dims[fdim]; } CHECK(numTimes == NumTimes && nr == Nr && nc == Nc, "datasets to be joined must have same dimensions"); arrayh5_destroy(a); } /* read first array back in */ fname = split_fname(h5_fnames[ifile], &data_name); if (!data_name[0]) data_name = data_label; err = arrayh5_read(&a, fname, data_name, NULL, nslicedim, slicedim, islice, center_slice); CHECK(!err, arrayh5_read_strerror[err]); free(fname); } else if (!join) { if (data_label) { for (it = 0; it < 9 && data_label[it]; ++it) VarName[0][it] = data_label[it]; VarName[0][it] = 0; } else { /* use file name, minus ".v5d" suffix, for var name */ int suff = strlen(v5d_fname) - 4; if (suff < 0 || strcmp(v5d_fname + suff, ".v5d")) suff += 4; /* no ".v5d"; suff = end of string */ for (it = 0; it < 9 && it < suff; ++it) VarName[0][it] = v5d_fname[it]; VarName[0][it] = 0; } for (iv = 1; iv < NumVars; ++iv) { Nl[iv] = Nl[0]; /* all variables have the same dims */ if (iv <= 999999999) /* paranoia: ensure sprintf is safe */ sprintf(VarName[iv], "%d", iv); else strcpy(VarName[iv], "Infinity"); } } for (it = 0; it < NumTimes; ++it) { TimeStamp[it] = it; DateStamp[it] = 0; /* don't bother to make up a real date */ } CompressMode = store_bytes; CHECK(CompressMode == 1 || CompressMode == 2 || CompressMode == 4, "can only store v5d data as 1, 2, or 4 bytes!"); Projection = 0; /* linear, rectangular, generic units */ ProjArgs[0] = ProjArgs[1] = 0; /* origin of row/col coord system */ ProjArgs[2] = ProjArgs[3] = 1; /* coord increment between rows/cols*/ Vertical = 0; /* equally spaced levels in generic units */ VertArgs[0] = 0.0; /* position of bottom level */ VertArgs[1] = 1.0; /* spacing between levels */ /* use v5dCreate call to create the v5d file and write the header */ if (!join || ifile == 0) { CHECK(v5dCreate(v5d_fname, NumTimes, NumVars, Nr, Nc, Nl, VarName, TimeStamp, DateStamp, CompressMode, Projection, ProjArgs, Vertical, VertArgs), "couldn't create v5d file"); } /* may call v5dSetLowLev() or v5dSetUnits() here; see Vis5d README */ /* allocate array for copying transpose of data: */ g = (float *) malloc(sizeof(float) * Nr * Nc * Nl[0]); CHECK(g, "out of memory!"); for (iv = join ? ifile : 0; iv < (join ? ifile + 1 : NumVars); ++iv) for (it = 0; it < NumTimes; ++it) { double *d = a.data + it + (join ? 0 : iv) * NumTimes * Nr * Nc * Nl[0]; if (!transpose) { int ir, ic, il; for (ir = 0; ir < Nr; ++ir) for (ic = 0; ic < Nc; ++ic) for (il = 0; il < Nl[0]; ++il) g[ir + Nr * (ic + Nc * il)] = d[(il + Nl[0] * (ic + Nc * ir)) * NumTimes]; } else { int id; for (id = 0; id < Nr * Nc * Nl[0]; ++id) g[id] = d[id * NumTimes]; } CHECK(v5dWrite(it + 1, iv + 1, g), "error writing v5d output"); } free(g); if (!join || ifile == num_h5 - 1) v5dClose(); arrayh5_destroy(a); if (v5d_fname) free(v5d_fname); v5d_fname = NULL; } } int main(int argc, char **argv) { char *v5d_fname = NULL, *data_name = NULL; extern char *optarg; extern int optind; int c; int verbose = 0, transpose = 0; int slicedim[4] = {NO_SLICE_DIM,NO_SLICE_DIM,NO_SLICE_DIM,NO_SLICE_DIM}; int islice[4], center_slice[4] = {0,0,0,0}; int store_bytes = 1; while ((c = getopt(argc, argv, "ho:d:vTV124x:y:z:t:0")) != -1) switch (c) { case 'h': usage(stdout); return EXIT_SUCCESS; case 'V': printf("h5tov5d " PACKAGE_VERSION " by Steven G. Johnson\n" "Copyright (c) 1999-2023 Massachusetts Institute of Technology\n" "\n" "This program is free software; you can redistribute it and/or modify\n" "it under the terms of the GNU General Public License as published by\n" "the Free Software Foundation; either version 2 of the License, or\n" "(at your option) any later version.\n" "\n" "This program is distributed in the hope that it will be useful,\n" "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" "GNU General Public License for more details.\n" ); return EXIT_SUCCESS; case 'v': verbose = 1; break; case 'T': transpose = 1; break; case 'x': islice[0] = atoi(optarg); slicedim[0] = 0; break; case 'y': islice[1] = atoi(optarg); slicedim[1] = 1; break; case 'z': islice[2] = atoi(optarg); slicedim[2] = 2; break; case 't': islice[3] = atoi(optarg); slicedim[3] = LAST_SLICE_DIM; break; case '0': center_slice[0] = center_slice[1] = center_slice[2] = 1; break; case '1': store_bytes = 1; break; case '2': store_bytes = 2; break; case '4': store_bytes = 4; break; case 'o': v5d_fname = my_strdup(optarg); break; case 'd': data_name = my_strdup(optarg); break; default: fprintf(stderr, "Invalid argument -%c\n", c); usage(stderr); return EXIT_FAILURE; } if (optind == argc) { /* no parameters left */ usage(stderr); return EXIT_FAILURE; } output_v5d(v5d_fname, data_name, 4, slicedim, islice, center_slice, store_bytes, transpose, argv + optind, argc - optind, v5d_fname != NULL); if (data_name) free(data_name); return EXIT_SUCCESS; } h5utils-1.13.2/h5tovtk.c000066400000000000000000000270151436105706500147570ustar00rootroot00000000000000/* Copyright (c) 1999-2023 Massachusetts Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include #include #include #include #include #include #include "config.h" #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #if defined(HAVE_ARPA_INET_H) # include #elif defined(HAVE_NETINET_IN_H) # include #endif #include "arrayh5.h" #include "copyright.h" #include "h5utils.h" #ifdef HAVE_UINT16_T typedef uint16_t my_uint16_t; #else typedef unsigned short my_uint16_t; #endif #ifdef HAVE_UINT32_T typedef uint32_t my_uint32_t; #else typedef unsigned long my_uint32_t; #endif #define CHECK(cond, msg) { if (!(cond)) { fprintf(stderr, "h5tovtk error: %s\n", msg); exit(EXIT_FAILURE); } } void usage(FILE *f) { fprintf(f, "Usage: h5tovtk [options] []\n" "Options:\n" " -h : this help message\n" " -V : print version number and copyright\n" " -v : verbose output\n" " -o : output datasets from all input files to ;\n" " combines 3 datasets to a vector, and 2 or 4+ to a field\n" " -4 : 4-byte floating-point binary output (default)\n" " -a : ASCII floating-point output\n" " -1 : 1-byte (0-255) binary output\n" " -2 : 2-byte (0-65535) binary output\n" " -n : don't convert binary output to bigendian\n" " -m : set bottom of scale for 1/2 byte encoding\n" " -M : set top of scale for 1/2 byte encoding\n" " -Z : center scale at zero for 1/2 byte encoding\n" " -r : invert scale & data values\n" " -x : take x= slice of data\n" " -y : take y= slice of data\n" " -z : take z= slice of data\n" " -t : take t= slice of data's last dimension\n" " -0 : use dataset center as origin for -x/-y/-z\n" " -d : use dataset in the input files (default: first dataset)\n" " -- you can also specify a dataset via :\n" ); } static void whitespace_to_underscores(char *s) { while (*s) { if (isspace(*s)) *s = '-'; ++s; } } static const char vtk_datatype[][20] = { "float", "unsigned_char", "unsigned_short", "none", "float" }; static void write_vtk_header(FILE *f, int is_binary, int nx, int ny, int nz, double ox, double oy, double oz, double sx, double sy, double sz) { fprintf(f, "# vtk DataFile Version 2.0\n" "Generated by h5tovtk.\n" "%s\n" "DATASET STRUCTURED_POINTS\n" "DIMENSIONS %d %d %d\n" "ORIGIN %g %g %g\n" "SPACING %g %g %g\n", is_binary ? "BINARY" : "ASCII", nx, ny, nz, ox, oy, oz, sx, sy, sz); } static void write_vtk_value(FILE *f, double v, int store_bytes, int fix_bytes, double min, double max, int invert) { if (invert) v = max - (v - min); switch (store_bytes) { case 0: fprintf(f, "%g ", v); break; case 1: { unsigned char c; c = floor((v - min) * 255.0 / (max - min) + 0.5); fwrite(&c, 1, 1, f); break; } case 2: { my_uint16_t i; i = floor((v - min) * 65535.0 / (max - min) + 0.5); if (fix_bytes) { #if defined(HAVE_HTONS) i = htons(i); #elif ! defined(WORDS_BIGENDIAN) unsigned char swap, *bytes; bytes = (unsigned char *) &i; swap = bytes[0]; bytes[0] = bytes[1]; bytes[1] = swap; #endif } fwrite(&i, 2, 1, f); break; } case 4: { float fv = v; if (fix_bytes) { #if defined(HAVE_HTONL) && (SIZEOF_FLOAT == 4) my_uint32_t *i = (my_uint32_t *) &fv; *i = htonl(*i); #elif ! defined(WORDS_BIGENDIAN) unsigned char swap, *bytes; bytes = (unsigned char *) &fv; swap = bytes[0]; bytes[0] = bytes[3]; bytes[3] = swap; swap = bytes[1]; bytes[1] = bytes[2]; bytes[2] = swap; #endif } fwrite(&fv, 4, 1, f); break; } } } int main(int argc, char **argv) { arrayh5 *a = NULL; char *vtk_fname = NULL, *data_name = NULL; extern char *optarg; extern int optind; double ox = 0, oy = 0, oz = 0, sx = 1, sy = 1, sz = 1; int c, ifile; int zero_center = 0; int invert = 0; double min = 0, max = 0; int min_set = 0, max_set = 0; int verbose = 0, combine = 0; int slicedim[4] = {NO_SLICE_DIM,NO_SLICE_DIM,NO_SLICE_DIM,NO_SLICE_DIM}; int islice[4], center_slice[4] = {0,0,0,0}; int nx = 0, ny = 0, nz = 0, na; int store_bytes = 4, fix_byte_order = 1; while ((c = getopt(argc, argv, "ho:d:vV124mMZranx:y:z:t:0")) != -1) switch (c) { case 'h': usage(stdout); return EXIT_SUCCESS; case 'V': printf("h5tovtk " PACKAGE_VERSION " by Steven G. Johnson\n" COPYRIGHT); return EXIT_SUCCESS; case 'v': verbose = 1; break; case 'x': islice[0] = atoi(optarg); slicedim[0] = 0; break; case 'y': islice[1] = atoi(optarg); slicedim[1] = 1; break; case 'z': islice[2] = atoi(optarg); slicedim[2] = 2; break; case 't': islice[3] = atoi(optarg); slicedim[3] = LAST_SLICE_DIM; break; case '0': center_slice[0] = center_slice[1] = center_slice[2] = 1; break; case 'n': fix_byte_order = 0; break; case 'a': store_bytes = 0; /* ascii */ break; case '1': store_bytes = 1; break; case '2': store_bytes = 2; break; case '4': store_bytes = 4; break; case 'm': min = atof(optarg); min_set = 1; break; case 'M': max = atof(optarg); max_set = 1; break; case 'Z': zero_center = 1; break; case 'r': invert = 1; break; case 'o': vtk_fname = my_strdup(optarg); combine = 1; break; case 'd': data_name = my_strdup(optarg); break; default: fprintf(stderr, "Invalid argument -%c\n", c); usage(stderr); return EXIT_FAILURE; } if (optind == argc) { /* no parameters left */ usage(stderr); return EXIT_FAILURE; } CHECK(store_bytes != 4 || sizeof(float) == 4, "'float' is wrong size for -4"); CHECK(store_bytes != 4 || sizeof(my_uint32_t) == 4, "missing 4-byte integer type for -4"); CHECK(store_bytes != 2 || sizeof(my_uint16_t) == 2, "missing 2-byte integer type for -2"); a = (arrayh5*) malloc(sizeof(arrayh5) * (na = argc - optind)); CHECK(a, "out of memory"); combine = combine && (na > 1); for (ifile = optind; ifile < argc; ++ifile) { char *dname, *found_dname, *h5_fname; int err, ia = ifile - optind; h5_fname = split_fname(argv[ifile], &dname); if (!dname[0]) dname = data_name; err = arrayh5_read(&a[ia], h5_fname, dname, &found_dname, 4, slicedim, islice, center_slice); CHECK(!err, arrayh5_read_strerror[err]); CHECK(a[ia].rank >= 1, "data must have at least one dimension"); CHECK(a[ia].rank <= 3, "data can have at most 3 dimensions (try taking a slice"); CHECK(!combine || !ia || arrayh5_conformant(a[ia], a[0]), "all arrays must be conformant to combine them"); if (!vtk_fname) vtk_fname = replace_suffix(h5_fname, ".h5", ".vtk"); { double a_min, a_max; arrayh5_getrange(a[ia], &a_min, &a_max); if (verbose) printf("data in %s ranges from %g to %g.\n", h5_fname, a_min, a_max); if (!min_set) min = (!combine || !ia || a_min < min) ? a_min : min; if (!max_set) max = (!combine || !ia || a_max > max) ? a_max : max; if (min > max) { invert = !invert; a_min = min; min = max; max = a_min; } if (zero_center) { max = fabs(max) > fabs(min) ? fabs(max) : fabs(min); min = -max; } } nx = a[ia].dims[0]; ny = a[ia].rank < 2 ? 1 : a[ia].dims[1]; nz = a[ia].rank < 3 ? 1 : a[ia].dims[2]; if (!combine) { FILE *f; int ix, iy, iz, N = nx * ny * nz; if (verbose) printf("writing \"%s\" from %dx%dx%d input data.\n", vtk_fname, nx, ny, nz); if (strcmp(vtk_fname, "-")) { f = fopen(vtk_fname, "w"); CHECK(f, "error creating file"); } else f = stdout; write_vtk_header(f, store_bytes, nx, ny, nz, ox, oy, oz, sx, sy, sz); whitespace_to_underscores(found_dname); fprintf(f, "POINT_DATA %d\n" "SCALARS %s %s 1\n" "LOOKUP_TABLE default\n", N, found_dname, vtk_datatype[store_bytes]); for (iz = 0; iz < nz; ++iz) for (iy = 0; iy < ny; ++iy) for (ix = 0; ix < nx; ++ix) { int i = (ix*ny + iy)*nz + iz; write_vtk_value(f, a[ia].data[i], store_bytes, fix_byte_order, min, max, invert); } if (f != stdout) fclose(f); arrayh5_destroy(a[ia]); free(vtk_fname); vtk_fname = NULL; } free(found_dname); free(h5_fname); } if (combine) { FILE *f; int ix, iy, iz, N = nx * ny * nz; if (verbose) printf("writing \"%s\" from %dx%dx%d input data.\n", vtk_fname, nx, ny, nz); if (strcmp(vtk_fname, "-")) { f = fopen(vtk_fname, "w"); CHECK(f, "error creating file"); } else f = stdout; write_vtk_header(f, store_bytes, nx, ny, nz, ox, oy, oz, sx, sy, sz); fprintf(f, "POINT_DATA %d\n", N); switch (na) { case 1: fprintf(f, "SCALARS scalars %s 1\nLOOKUP_TABLE default\n", vtk_datatype[store_bytes]); break; case 3: fprintf(f, "VECTORS vectors %s\n", vtk_datatype[store_bytes]); break; default: fprintf(f, "FIELD fields 1\narray %d %d %s\n", na, N, vtk_datatype[store_bytes]); } for (iz = 0; iz < nz; ++iz) for (iy = 0; iy < ny; ++iy) for (ix = 0; ix < nx; ++ix) { int ia, i = (ix*ny + iy)*nz + iz; for (ia = 0; ia < na; ++ia) write_vtk_value(f, a[ia].data[i], store_bytes, fix_byte_order, min, max, invert); } if (f != stdout) fclose(f); { int ia; for (ia = 0; ia < na; ++ia) arrayh5_destroy(a[ia]); } } free(a); if (data_name) free(data_name); return EXIT_SUCCESS; } h5utils-1.13.2/h5utils.c000066400000000000000000000062231436105706500147460ustar00rootroot00000000000000/* Copyright (c) 1999-2023 Massachusetts Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include #include #include #include "config.h" #include "h5utils.h" #define CHECK(cond, msg) { if (!(cond)) { fprintf(stderr, "h5utils error: %s\n", msg); exit(EXIT_FAILURE); } } char *my_strdup(const char *s) { if (s) { char *sd = (char *) malloc(sizeof(char) * (strlen(s) + 1)); CHECK(sd, "out of memory"); strcpy(sd, s); return sd; } return NULL; } char *replace_suffix(const char *s, const char *old_suff, const char *new_suff) { char *new_s; int s_len, old_suff_len, new_suff_len; s_len = strlen(s); old_suff_len = strlen(old_suff); new_suff_len = strlen(new_suff); new_s = (char*) malloc(sizeof(char) * (s_len + new_suff_len + 1)); CHECK(new_s, "out of memory"); strcpy(new_s, s); if (s_len >= old_suff_len && !strcmp(new_s + s_len - old_suff_len, old_suff)) new_s[s_len - old_suff_len] = 0; /* delete old suffix */ strcat(new_s, new_suff); return new_s; } /* given an fname of the form :, return a pointer to a newly-allocated string containing , and point data_name to the position of in fname. The user must free() the string. */ char *split_fname(char *fname, char **data_name) { int fname_len; char *colon, *filename; fname_len = strlen(fname); colon = strchr(fname, ':'); if (colon) { int colon_len = strlen(colon); filename = (char*) malloc(sizeof(char) * (fname_len-colon_len+1)); CHECK(filename, "out of memory"); strncpy(filename, fname, fname_len-colon_len+1); filename[fname_len-colon_len] = 0; *data_name = colon + 1; } else { /* treat as if ":" were at the end of fname */ filename = (char*) malloc(sizeof(char) * (fname_len + 1)); CHECK(filename, "out of memory"); strcpy(filename, fname); *data_name = fname + fname_len; } return filename; } h5utils-1.13.2/h5utils.h000066400000000000000000000025701436105706500147540ustar00rootroot00000000000000/* Copyright (c) 1999-2023 Massachusetts Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef H5UTILS_H #define H5UTILS_H extern char *my_strdup(const char *s); extern char *replace_suffix(const char *s, const char *old_suff, const char *new_suff); extern char *split_fname(char *fname, char **data_name); #endif /* H5UTILS_H */ h5utils-1.13.2/writepng.c000066400000000000000000000372401436105706500152130ustar00rootroot00000000000000/* Copyright (c) 1999-2023 Massachusetts Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include #include #include #include #include #include "writepng.h" #define MAX(a,b) ((a) > (b) ? (a) : (b)) #define MIN(a,b) ((a) < (b) ? (a) : (b)) #define PIN(min, x, max) MIN(MAX(min, x), max) /* convert a value val in [0,1] to a color from the colormap */ static void cmap_lookup(REAL val, colormap_t cmap, float *r, float *g, float *b, float *a) { double w; int i = val * (cmap.n - 1); if (i > cmap.n - 2) i = cmap.n - 2; if (i < 0) i = 0; w = val * (cmap.n - 1) - i; *r = cmap.rgba[i].r * (1 - w) + cmap.rgba[i+1].r * w; *g = cmap.rgba[i].g * (1 - w) + cmap.rgba[i+1].g * w; *b = cmap.rgba[i].b * (1 - w) + cmap.rgba[i+1].b * w; *a = cmap.rgba[i].a * (1 - w) + cmap.rgba[i+1].a * w; } static void convert_row(int png_width, int data_width, REAL scaley, REAL offsety, REAL *datarow, REAL *datarow2, REAL weightrow, int stride, REAL *maskrow, REAL *maskrow2, REAL mask_thresh, REAL *mask_prev, int init_mask_prev, png_byte mask_byte, int mny, int mstride, int overlay, REAL *olayrow, REAL *olayrow2, colormap_t olay_cmap, REAL olaymin, REAL olaymax, int ony, int ostride, colormap_t cmap, REAL minrange, REAL maxrange, REAL scale, png_byte * row_pointer, int eight_bit) { int i; for (i = 0; i < png_width; ++i) { REAL y = i * scaley + offsety; int n = PIN(0, (int) (y + 0.5), data_width-1); double delta = y - n; REAL val, maskval = 0.0, olayval = olaymin; if (n < 0 || n > data_width) { if (eight_bit) row_pointer[i] = 255; else row_pointer[3*i] = row_pointer[3*i + 1] = row_pointer[3*i + 2] = mask_byte; continue; } if (delta == 0.0) { val = (datarow[n * stride] * weightrow + datarow2[n * stride] * (1 - weightrow)); if (maskrow != NULL) { maskval = (maskrow[(n%mny) * mstride] * weightrow + maskrow2[(n%mny) * mstride] * (1 - weightrow)); } if (overlay) olayval = (olayrow[(n%ony) * ostride] * weightrow + olayrow2[(n%ony) * ostride] * (1 - weightrow)); } else { int n2 = PIN(0, n + (delta < 0.0 ? -1 : 1), data_width-1); REAL absdelta = fabs(delta); val = (datarow[n * stride] * (1 - absdelta) + datarow[n2 * stride] * absdelta) * weightrow + (datarow2[n * stride] * (1 - absdelta) + datarow2[n2 * stride] * absdelta) * (1 - weightrow); if (overlay) olayval = (olayrow[(n%ony) * ostride] * (1 - absdelta) + olayrow[(n2%ony) * ostride] * absdelta) * weightrow + (olayrow2[(n%ony) * ostride] * (1 - absdelta) + olayrow2[(n2%ony) * ostride] * absdelta) * (1 - weightrow); if (maskrow != NULL) { maskval = (maskrow[(n%mny) * mstride] * (1 - absdelta) + maskrow[(n2%mny) * mstride] * absdelta) * weightrow + (maskrow2[(n%mny) * mstride] * (1 - absdelta) + maskrow2[(n2%mny) * mstride] * absdelta) * (1 - weightrow); } } if (maskrow != NULL) { REAL maskmin, maskmax; if (init_mask_prev) maskmin = maskmax = maskval; else { maskmin = MIN(MIN(maskval, i ? mask_prev[i-1] : maskval), mask_prev[i]); maskmax = MAX(MAX(maskval, i ? mask_prev[i-1] : maskval), mask_prev[i]); } mask_prev[i] = maskval; if (maskmin <= mask_thresh && maskmax >= mask_thresh) { if (eight_bit) row_pointer[i] = 255; else row_pointer[3*i] = row_pointer[3*i + 1] = row_pointer[3*i + 2] = mask_byte; continue; } } if (val > maxrange) val = maxrange; else if (val < minrange) val = minrange; if (eight_bit) row_pointer[i] = (val - minrange) * scale; else if (overlay) { float r, g, b, a, ro, go, bo, ao; cmap_lookup((val - minrange) / (maxrange - minrange), cmap, &r, &g, &b, &a); cmap_lookup((olayval - olaymin) / (olaymax - olaymin), olay_cmap, &ro, &go, &bo, &ao); r = r * (1 - ao) + ro * ao; g = g * (1 - ao) + go * ao; b = b * (1 - ao) + bo * ao; row_pointer[3*i ] = r * 255 + 0.5; row_pointer[3*i + 1] = g * 255 + 0.5; row_pointer[3*i + 2] = b * 255 + 0.5; } else { float r, g, b, a; cmap_lookup((val - minrange) / (maxrange - minrange), cmap, &r, &g, &b, &a); row_pointer[3*i ] = r * 255 + 0.5; row_pointer[3*i + 1] = g * 255 + 0.5; row_pointer[3*i + 2] = b * 255 + 0.5; } } } static void init_palette(png_colorp palette, colormap_t colormap, png_byte mask_byte) { int i; for (i = 0; i < 255; ++i) { int j = i * 1.0/254 * (colormap.n - 1); int j2 = (j == colormap.n - 1) ? j : j + 1; REAL dj = i * 1.0/254 * (colormap.n - 1) - j; float r,g,b; r = colormap.rgba[j].r * (1-dj) + colormap.rgba[j2].r * dj; g = colormap.rgba[j].g * (1-dj) + colormap.rgba[j2].g * dj; b = colormap.rgba[j].b * (1-dj) + colormap.rgba[j2].b * dj; palette[i].red = r * 255 + 0.5; palette[i].green = g * 255 + 0.5; palette[i].blue = b * 255 + 0.5; } /* set mask color: */ palette[255].green = palette[255].blue = palette[255].red = mask_byte; } #define USE_ALPHA 0 #if USE_ALPHA static void init_alpha(png_structp png_ptr, png_infop info_ptr, colormap_t colormap) { int i; png_bytep trans; for (i = 0; i < colormap.n; ++i) if ((int) (colormap.rgba[i].a * 255 + 0.5) < 255) break; if (i >= colormap.n) return; /* all colors are opaque */ trans = (png_bytep) malloc(sizeof(png_byte) * 256); for (i = 0; i < 255; ++i) { int j = i * 1.0/254 * (colormap.n - 1); int j2 = (j == colormap.n - 1) ? j : j + 1; REAL dj = i * 1.0/254 * (colormap.n - 1) - j; float a = colormap.rgba[j].a * (1-dj) + colormap.rgba[j2].a * dj; trans[i] = a * 255 + 0.5; } trans[255] = 255; /* mask is always opaque */ png_set_tRNS(png_ptr, info_ptr, trans, 256, 0); } #endif void writepng(char *filename, int nx, int ny, int transpose, REAL skew, REAL scalex, REAL scaley, REAL * data, REAL *mask, REAL mask_thresh, int mnx, int mny, REAL *overlay, colormap_t overlay_cmap, int onx, int ony, REAL minrange, REAL maxrange, colormap_t colormap, int eight_bit) { FILE *fp; png_structp png_ptr; png_infop info_ptr; int height, width; double skewsin = sin(skew), skewcos = cos(skew); REAL minoverlay = 0, maxoverlay = 0; png_byte mask_byte; /* we must use direct color for translucent overlays */ if (overlay) eight_bit = 0; /* compute png size from scaled (and possibly transposed) data size, * and reverse the meaning of the scale factors; now they are what we * multiply png coordinates by to get data coordinates: */ if (transpose) { height = MAX(1, ny * scalex * skewcos); width = MAX(1, nx * scaley * (1.0 + fabs(skewsin))); scalex = height==1 ? 0 : (1.0 * (ny-1)) / (height-1); scaley = width==1 ? 0 : ((1.0 + fabs(skewsin)) * (nx-1)) / (width-1); } else { height = MAX(1, nx * scalex * skewcos); width = MAX(1, ny * scaley * (1.0 + fabs(skewsin))); scalex = height==1 ? 0 : (1.0 * (nx-1)) / (height-1); scaley = width==1 ? 0 : ((1.0 + fabs(skewsin)) * (ny-1)) / (width-1); } if (overlay) { int i; minoverlay = maxoverlay = overlay[0]; for (i = 1; i < onx * ony; ++i) { if (minoverlay > overlay[i]) minoverlay = overlay[i]; if (maxoverlay < overlay[i]) maxoverlay = overlay[i]; } } /* determine mask color by middle of colormap (FIXME: use median color of the data or some such thing instead?) */ { float r,g,b,a; cmap_lookup(0.5, colormap, &r, &g, &b, &a); if ((r + g + b) / 3.0 > 0.5) mask_byte = 0; /* black */ else mask_byte = 255; /* white */ } fp = fopen(filename, "wb"); if (fp == NULL) { perror("Error creating file to write PNG in"); return; } /* Create and initialize the png_struct with the desired error * handler * functions. If you want to use the default stderr and * longjump method, * you can supply NULL for the last three * parameters. We also check that * the library version is * compatible with the one used at compile time, * in case we are * using dynamically linked libraries. REQUIRED. */ png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL,NULL); if (png_ptr == NULL) { fclose(fp); return; } /* Allocate/initialize the image information data. REQUIRED */ info_ptr = png_create_info_struct(png_ptr); if (info_ptr == NULL) { fclose(fp); png_destroy_write_struct(&png_ptr, (png_infopp) NULL); return; } /* Set error handling. REQUIRED if you aren't supplying your own * * error hadnling functions in the png_create_write_struct() call. */ if (setjmp(png_jmpbuf(png_ptr))) { /* If we get here, we had a problem reading the file */ fclose(fp); png_destroy_write_struct(&png_ptr, (png_infopp) NULL); return; } /* set up the output control if you are using standard C streams */ png_init_io(png_ptr, fp); /* Set the image information here. Width and height are up to 2^31, bit_depth is one of 1, 2, 4, 8, or 16, but valid values also depend on the color_type selected. color_type is one of PNG_COLOR_TYPE_GRAY, PNG_COLOR_TYPE_GRAY_ALPHA, PNG_COLOR_TYPE_PALETTE, PNG_COLOR_TYPE_RGB, or PNG_COLOR_TYPE_RGB_ALPHA. interlace is either PNG_INTERLACE_NONE or PNG_INTERLACE_ADAM7, and the compression_type and filter_type MUST currently be PNG_COMPRESSION_TYPE_BASE and PNG_FILTER_TYPE_BASE. REQUIRED */ if (!eight_bit) png_set_IHDR(png_ptr, info_ptr, width, height, 8 /* bit_depth */ , PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE); else { png_colorp palette; png_set_IHDR(png_ptr, info_ptr, width, height, 8 /* bit_depth */ , PNG_COLOR_TYPE_PALETTE, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE); /* initialize alpha channel (if any) via png_set_tRNS */ #if USE_ALPHA init_alpha(png_ptr, info_ptr, colormap); #endif palette = (png_colorp) png_malloc(png_ptr, 256 * sizeof(png_color)); /* set the palette if there is one. REQUIRED for indexed-color * images */ init_palette(palette, colormap, mask_byte); png_set_PLTE(png_ptr, info_ptr, palette, 256); } /* Write the file header information. REQUIRED */ png_write_info(png_ptr, info_ptr); /* Write out data, one row at a time: */ { REAL scale, *mask_prev = NULL; png_byte *row_pointer; int row; int data_height = transpose ? ny : nx; int data_width = transpose ? nx : ny; if (maxrange > minrange) scale = 254.0 / (maxrange - minrange); else scale = 0.0; row_pointer = (png_byte *) malloc(width * sizeof(png_byte) * (eight_bit ? 1 : 3)); if (row_pointer == NULL) { fclose(fp); return; } if (mask) { mask_prev = (REAL *) malloc(width * sizeof(REAL)); if (mask_prev == NULL) { free(row_pointer); fclose(fp); return; } } for (row = height-1; row >= 0; --row) { REAL x = row * scalex; int n = PIN(0,(int) (x + 0.5), data_height-1); double delta = x - n; int n2 = PIN(0,n + (delta>0.0 ? 1 : -1), data_height-1); int n3 = PIN(0,n + 1, data_height-1); REAL offset; if (skewsin < 0.0) offset = x*skewsin; else offset = (x - (height-1)*scalex) * skewsin; if (transpose) convert_row(width, data_width, scaley, offset, data + n, data + n2, 1 - fabs(delta), data_height, mask ? mask + (n%mny) : NULL, mask ? mask + (n3%mny) : NULL, mask_thresh, mask_prev, row == height-1, mask_byte, mnx, mny, overlay != 0, overlay + (n%ony), overlay + (n2%ony), overlay_cmap, minoverlay, maxoverlay, onx, ony, colormap, minrange, maxrange, scale, row_pointer, eight_bit); else convert_row(width, data_width, scaley, offset, data + n * data_width, data + n2 * data_width, 1 - fabs(delta), 1, mask ? mask + (n%mnx) * mny : NULL, mask ? mask + (n3%mnx) * mny : NULL, mask_thresh, mask_prev, row == height-1, mask_byte, mny, 1, overlay != 0, overlay + (n%onx) * ony, overlay + (n2%onx) * ony, overlay_cmap, minoverlay, maxoverlay, ony, 1, colormap, minrange, maxrange, scale, row_pointer, eight_bit); png_write_rows(png_ptr, &row_pointer, 1); } free(row_pointer); free(mask_prev); } /* It is REQUIRED to call this to finish writing the rest of the file */ png_write_end(png_ptr, info_ptr); /* if you malloced the palette, free it here */ { png_colorp palette; int num_palette; if (0 != png_get_PLTE(png_ptr, info_ptr, &palette, &num_palette)) png_free(png_ptr, palette); } /* if you allocated any text comments, free them here */ /* clean up after the write, and free any memory allocated */ png_destroy_write_struct(&png_ptr, (png_infopp) NULL); /* close the file */ fclose(fp); /* that's it */ } /* In the following code, we use a heuristic algorithm to compute * the range. The range is set to [-r, r], where r is computed * as follows: * * 1) for each new data set, compute * r' = sqrt(2.0 * (average of non-zero data[i]^2)) * * 2) r = max(r', r of previous data set) */ #define WHITE_EPSILON 0.003921568627 /* 1 / 255 */ void writepng_autorange(char *filename, int nx, int ny, int transpose, REAL skew, REAL scalex,REAL scaley, REAL * data, REAL *mask, REAL mask_thresh, REAL *overlay, colormap_t overlay_cmap, colormap_t colormap, int eight_bit) { static REAL range = 0.0; REAL sum = 0, newrange, max = -1.0; int i, count = 0; sum = 0; for (i = 0; i < nx * ny; ++i) { REAL absval = fabs(data[i]); if (absval >= WHITE_EPSILON * range) { sum += absval * absval; ++count; } if (absval > max) max = absval; } if (count) { newrange = 5 * sqrt(sum / count); if (newrange > max) newrange = max; if (newrange > range) range = newrange; } writepng(filename, nx, ny, transpose, skew, scalex, scaley, data, mask, mask_thresh, nx,ny, overlay, overlay_cmap, nx,ny, -range, range, colormap, eight_bit); } h5utils-1.13.2/writepng.h000066400000000000000000000043251436105706500152160ustar00rootroot00000000000000/* Copyright (c) 1999-2023 Massachusetts Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef WRITEPNG_H #define WRITEPNG_H #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ /***********************************************************************/ #ifdef SINGLE_PRECISION typedef float REAL; #else typedef double REAL; #endif typedef struct { float r, g, b, a; } rgba_t; typedef struct { int n; rgba_t *rgba; } colormap_t; void writepng(char *filename, int nx, int ny, int transpose, REAL skew, REAL scalex, REAL scaley, REAL *data, REAL *mask, REAL mask_thresh, int mnx, int mny, REAL *overlay, colormap_t overlay_cmap, int onx, int ony, REAL minrange, REAL maxrange, colormap_t colormap, int eight_bit); void writepng_autorange(char *filename, int nx, int ny, int transpose, REAL skew, REAL scalex, REAL scaley, REAL *data, REAL *mask, REAL mask_thresh, REAL *overlay, colormap_t overlay_cmap, colormap_t colormap, int eight_bit); /***********************************************************************/ #ifdef __cplusplus } /* extern "C" */ #endif /* __cplusplus */ #endif /* WRITEPNG_H */