= Fault System Solution Zip File Format Documentation = UCERF3 (and potentially other forecast) data is stored in a zip file format, this page describes how to parse these zip files. If you are using Java, a parser is already written in OpenSHA via the [source:trunk/dev/scratch/UCERF3/utils/FaultSystemIO.java scratch.UCERF3.utils.FaultSystemIO] class. == File Formats Used == You must write a parser for each of the following file formats in order to load in a fault system solution. === Double array binary file === These files contain an array of double values in a binary format. These files simply contain a series of big endian 8 bit double precision floating point numbers. The size of this file will be equal to the number of values x 8 bits. === Integer array list binary file === These files contain a list of integer arrays in a binary format. All file entries are 4-bit big endian integer values. The first value in the file is the number of integer arrays stored in the file. Then each array is written to the file by first writing the number of elements in the array, then each value in the array. For example, consider the following 3 arrays: {{{ [ 0 6 2 4 ] [ 3 6 2 ] [ 3 7 9 1 4 7 ] }}} This would be written as (all stored as big endian 4-bit integers): '''[[span(style=color: #FF0000, 3)]] [[span(style=color: #0000FF, 4)]] 0 6 2 4 [[span(style=color: #0000FF, 3)]] 3 6 2 [[span(style=color: #0000FF, 6)]] 3 7 9 1 4 7''' In this example, '''[[span(style=color: #FF0000, the number of arrays is in red)]]''', '''[[span(style=color: #0000FF, each array's size in blue)]]''', '''and array data is in black'''. === Fault section data XML file === Each fault subsection is stored in an XML file, an example of which is shown below. {{{ ... ... ... }}} === Grid Sources XML file === Some solutions will contain gridded seismicity magnitude frequency distributions. Here is an example XML file: NOTE: UCERF3 uses the RELM region evenly discretized at 0.1 degrees for gridded seismicity. Due to the complexities involved in reproducing our gridding exactly, a file is posted here with grid node indexes and locations for this region: http://opensha.usc.edu/ftp/kmilner/ucerf3/relm_gridded_region.csv {{{ ... ... ... ... }}} == Zip File Contents == The following files constitute a Fault System Solution ||= File Name =||= File Format =||= Optional? =||= Description =|| ||'''fault_sections.xml'''||XML (see above)||no||This XML file describes each sub section in the Fault System. These indexes will be referred to in the rup_sections.bin file when defining ruptures.|| ||'''grid_sources.xml'''||XML (see above)||yes||This XML file, if present, gives gridded seismicity MFDs at each node in the region that this solution covers.|| ||'''info.txt'''||ASCII||yes||This text file, if present, contains metadata describing the solution.|| ||'''mags.bin'''||Double array binary||no||This file gives magnitudes for each rupture. It contains one double value for each rupture index, in order.|| ||'''rakes.bin'''||Double array binary||no||This file gives average rakes for each rupture. It contains one double value for each rupture index, in order.|| ||'''rates.bin'''||Double array binary||no||This file gives annualized rates for each rupture. It contains one double value for each rupture index, in order.|| ||'''rup_areas.bin'''||Double array binary||no||This file gives areas for each rupture in SI units (square meters). It contains one double value for each rupture index, in order.|| ||'''rup_lengths.bin'''||Double array binary||yes||This file, if present, gives lengths for each rupture in SI units (meters). It contains one double value for each rupture index, in order.|| ||'''rup_sections.bin'''||Integer array list binary||no||This lists the sub sections involved in each rupture. It consists of numRuptures arrays, each of which lists the sub sections indexes (as defined in fault_sections.xml) for that rupture|| ||'''sect_areas.bin'''||Double array binary||yes||This file gives areas for each fault sub section in SI units (square meters). It contains one double value for each sub section index, in order.||