Changes between Version 3 and Version 4 of Examples/Ear5Animating
- Timestamp:
- 07/10/18 10:30:57 (6 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Examples/Ear5Animating
v3 v4 2 2 == Dataformats and Tools == 3 3 === NetCDF and HDF5 on JURECA === 4 As HDF5 is the preferred dataformat for ParaView, maybe a conversion from netCDF-3 to netCDF-4 (which in fact is a HDF5 file) is necessary. So one has to deal with som netcdf and hdf5 tools. 4 The typical data format in climate science is NetCDF. Though NetCDF files can be loaded in !ParaView, this approach is very unflexible, as !ParaViews NetCDF reader makes some fixed assumptions regarding some naming conventions of the variables. 5 Fortunately, NetCDF files geenrated with the newer NetCDF version 4 are based on HDF5 and can be loaded with !ParaViews [http://xdmf.org XDMF] reader. 6 In case one has older NetCDF files of version 3, a conversion from NetCDF-3 to NetCDF-4 is necessary. So one has to deal with som NetCDF and HDF5 related tools. 5 7 6 How to find out what modules to load for NetCDF/HDF5 :8 How to find out what modules to load for NetCDF/HDF5 on JURECA: 7 9 {{{ 8 10 #!bash … … 19 21 }}} 20 22 21 Just some examples of how to use h5dump:23 Just as a reminder some examples of how to use h5dump: 22 24 {{{ 23 25 #!bash … … 32 34 ncdump -k foo.nc 33 35 }}} 34 If ncdump returns netCDF-4, or netCDF-4 classic model, then congratulations, you already have an HDF file, as netCDF-4 is the netCDF data model implemented using HDF5 as the storage layer. These files can be ready by the HDF library version 1.8 or later, and from what I can tell, pytables. If ncdump returns classic or 64-bit offset, then you are using netCDF-3 and will need to convert to netCDF-4 (and thus HDF ). The good news is that if you have netCDF installed, you can do the conversion pretty easily:36 If ncdump returns netCDF-4, or netCDF-4 classic model, then congratulations, you already have an HDF file, as netCDF-4 is the netCDF data model implemented using HDF5 as the storage layer. These files can be ready by the HDF library version 1.8 or later, and from what I can tell, pytables. If ncdump returns classic or 64-bit offset, then you are using netCDF-3 and will need to convert to netCDF-4 (and thus HDF5). The good news is that if you have netCDF installed, you can do the conversion pretty easily: 35 37 {{{ 36 38 #!bash … … 38 40 }}} 39 41 40 Graphical hdf5 viewer:42 Graphical HDF5 viewer: 41 43 HDFView is a very handy tool to investigate hdf5 files. To open HDFView on JURECA, either click on the HDFView icon on the desktop. Or launch HDFView by 42 44 {{{ … … 46 48 47 49 === Python on JURECA === 48 To use Python on JURECA, you have to load some modules first. Here are some useful commands:50 To use python on JURECA, you have to load some modules first. Here are some useful commands: 49 51 {{{ 50 52 #!bash … … 60 62 The files are stored at /data/slmet/slmet111/met_data/ecmwf/era5/netcdf4/2017/ 61 63 62 The files cover the period of time for the monthJune and August 2017 in 1 h steps.63 Example of a filename:2017061516_ml.nc (YYYYMMDDHH)64 The files cover the months June and August 2017 in 1 h steps. 65 For every file, its date is recorded in its filename. e.g. 2017061516_ml.nc (YYYYMMDDHH) 64 66 65 Some interesting variables stored in the *ml-files:67 Some interesting variables stored in the 3D *ml-files: 66 68 - cc (1 x 137 x 601 x 1200): Fraction of cloud cover 67 69 - ciwc (1 x 137 x 601 x 1200): Specific cloud ice water content … … 81 83 - lev, lev_2 (137): hybrid_sigma_pressure, ranging from 1 to 137 (137 is ground level!) 82 84 83 Calculation of Coordinates:\\84 !ParaView natively does not understand the original coordinates (lat, lon, lev_2). Therefore, these must be converted into a "structured grid" data structure . See thethe "generate_coordinates.py" script.85 Calculation of coordinates:\\ 86 !ParaView natively does not understand the original coordinates (lat, lon, lev_2). Therefore, these must be converted into a "structured grid" data structure, where every node of the 3D grid has its own 3D coordinate. This calculation is done in the "generate_coordinates.py" script. 85 87 In this script also the conversion to Cartesian coordinates takes place essentially via: 86 88 {{{ … … 92 94 }}} 93 95 The generated coordinates are stored in the new created file "coordinates.h5". 94 ATTENTION: !ParaView can read this "structured grid", but cannot volume-render it, as volume rendering only works good for data of type "image data". Therefore, the filter "Resample to Image" must be applied to the reader in !ParaView!96 ATTENTION: !ParaView can read this "structured grid", but cannot volume-render it, as volume rendering with [https://www.ospray.org/ OspRay] or GPU-based only works for data of type "image data", wich is a 3D rectiliniear grid. Therefore, the filter "Resample to Image" must be applied to the reader in !ParaView! 95 97 96 98 Create XDMF file:\\ 97 The hdf5 files are loaded via an xdmf reader. To enable this, an xdmf file must be created first . The script "make_xdmf.py" does this. The script essentially scans the directory where the files are located and gets the names of all files for one month (the month is fixed in the script).98 Variables that can be later loaded into !ParaView are noted in the script in a python list:99 The hdf5 files are loaded via an xdmf reader. To enable this, an xdmf file must be created first, containing information about alle time steps and all variables. The script "make_xdmf.py" does this. The script essentially scans the directory where the data files are located and gets the names of all files for one month (the definition of the month is fixed in the script). 100 Variables that can be later loaded into !ParaView are noted in the script in form of a python list: 99 101 {{{ 100 102 #!python 101 scalars=["cc", "ciwc", "clwc", "q", "d", "vo", "o3", "w"] ]103 scalars=["cc", "ciwc", "clwc", "q", "d", "vo", "o3", "w"] 102 104 }}} 103 105 The name of the xdmf-output file is structuredgrid_201709.xdmf. … … 105 107 == !ParaView == 106 108 === Loading the necessary modules === 107 The modules can be found out with "module spider !ParaView/5.5.0".109 The needed modules can be found out with "module spider !ParaView/5.5.0". 108 110 Load modules e.g. with: 109 111 {{{ … … 119 121 }}} 120 122 The GUI is well suited to prototype the scene. In the GUI one can define the visualization pipeline with its parameters, i.e. the readers and filters, the color tables and the camera positions. However, for various reasons it makes sense to script the visualization with paraview-python: 121 - In the script all parameters are recorded in text form 122 - Loading !ParaView GUI state s sometimes does not work123 - In the script all parameters are recorded in text form, so one can look up these parameters later 124 - Loading !ParaView GUI state files sometimes does not work 123 125 - !ParaView has a memory leak, so after a number of render steps you have to quit !ParaView and restart it at the aborted location (otherwise !ParaView would crash). This can be automated using a script. 124 126 … … 127 129 How To transfer pipeline parameters from GUI to script:\\ 128 130 In the !ParaView-GUI, start a Python trace by Tools->Start Trace. 129 Then create the pipeline you want. (Most of) the corresponding Python commands are displayed in the trace. These can be transferred into a script with copy & paste .131 Then create the pipeline you want. (Most of) the corresponding Python commands are displayed in the trace. These can be transferred into a script with copy & paste and, if needed, modified there. 130 132 131 133 How To transfer colormaps from GUI to script:\\ 132 134 Once you have designed a good colormap in the GUI, you can save it there as a preset. This preset can then be renamed and saved to disk as a *.json file. 133 Since a different colormap makes sense for each variable, one will end up with mor then one colormap file. In this example the naming scheme for colormap files is "stein_''variable''.json", e.g. "stein_vo.json" for the vorticity. This naming scheme is expected in the Python scripts, which among other things load the color tables.135 Since a different colormap makes sense for each variable, one will end up with more then one colormap file. In this example the naming scheme for colormap files is "stein_''variable''.json", e.g. "stein_vo.json" for the vorticity. This naming scheme is expected in the Python scripts, which among other things load the color tables. 134 136 135 How To transfer camera parameter from GUI to script:\\137 How To transfer camera parameters from GUI to script:\\ 136 138 You can save four (and more) camera positions in the !ParaView GUI. Click on the camera icon ("Adjust Camera"), then "configure", then "Assign current view". The camera positions can be saved in an XML file via "export" and can later be loaded and used in the Python script e.g. with: 137 139 {{{ … … 154 156 155 157 === How-To start a !ParaView script === 156 Generally a !ParaView Python script is started with "pvpython script.py" (or, on a VNC-server, by "vglrun pvpython script.py"). On JURECA, however, the following approach is necessary: first start a pvserver on display :0.0 and let pvpython connect to this server. This can be done in one command line:158 Generally a !ParaView python script is started with "pvpython script.py" (or, on a VNC-server, like JURECA, by "vglrun pvpython script.py"). On JURECA, however, the following approach is necessary: first start a pvserver on display :0.0 and let pvpython connect to this server. This can be done in one command line: 157 159 {{{ 158 160 #!bash … … 165 167 === Prerequisites === 166 168 - Data is located as described above in /data/slmet/slmet111/met_data/ecmwf/era5/netcdf4/2017/ 167 - On JURECA, the modules for Python a re loaded, e.g. with "module use otherstages && modules --force purge && module load !Stages/Devel-2017b GCC/7.2.0 ParaStationMPI/5.2.0-1 h5py/2.7.1-Python-2.7.14"168 - The following scripts are installed: generate_coordinates.py, make_xdmf.py, make_movie_pvserver.sh, paraview_make_movie_pvserver.py169 - Color tables for two attributes are installed: stein_ciwc.json and stein_clwc.json170 - Camera positions for two attributes are installed: camera_ciwc.pvcvbc and camera_clwc.pvcvbc171 - Texture earth_heller_transformed.jpg is installed169 - On JURECA, the modules for Python and H5PY are loaded, e.g. with "module use otherstages && modules --force purge && module load !Stages/Devel-2017b GCC/7.2.0 ParaStationMPI/5.2.0-1 h5py/2.7.1-Python-2.7.14" 170 - The following scripts are available: generate_coordinates.py, make_xdmf.py, make_movie_pvserver.sh, paraview_make_movie_pvserver.py 171 - Color tables for two attributes are available: stein_ciwc.json and stein_clwc.json 172 - Camera positions for two attributes are available: camera_ciwc.pvcvbc and camera_clwc.pvcvbc 173 - Texture earth_heller_transformed.jpg is available 172 174 173 175 === Step 1: Create coordinates ===