JSON Formatted Files in EEMS
JSON (JavaScript Object Notation) is an increasingly common standard data format to store and transmit data objects that use text designed to be easily read by humans. JSON serves as a syntax for serializing objects, arrays, numbers, strings, booleans, and null. Although it is based upon JavaScript syntax, it is distinct from it.
Recently, DSI has seen advantages in applying this data format for EFDC+ input files. When John Hamrick developed the original EFDC input files in the early 1990’s, the 80 column card format was used. As more features and variables have been added, these input file formats have become cumbersome and prone to error. With the release of EEMS10.3, we have started moving the EFDC+ input files to the JSON format. To avoid confusion with conventional JSON files, we have changed this new file extension in EFDC+ to JNP. JSON readers can read and display this format; it makes it easy for users to visualize the information and it will make the addition of fields for new features much more straightforward.
Some of the EFDC+ input files that use the new format include those related to MPI, propwash, and the new biota functionality:
decomp.jnp MPI decomposition settings (if MPI is being used)
wq_3dwc.jnp Eutrophication controls
wq_biota.jnp Biota controls
wq_zooplankton.jnp Zooplankton controls
wq_3dsd.jnp Sediment diagenesis controls
wq_rpem.jnp Rooted plant and epiphyte controls
propwash_config.jnp Propwash computation configuration options
propwash_tracks.jnp Ship track, draft, and applied power time series
propwash_ships.jnp Ship and propeller properties
The upcoming tropical cyclone file will use the JNP format. It is also possible the EFDC.INP file will eventually migrate to the JNP format. However, no time series files will be updated to JNP: they will continue to use the conventional EFDC input file format.
An example of a JSON file is the decomp.jnp shown below:
{
“number_i_subdomains”: 2,
“number_j_subdomains”: 1,
“number_active_subdomains”: 2,
“i_subdomain_widths”: [ 398, 212 ],
“j_subdomain_widths”: [ 1271 ],
“active_flag”: [ 1, 1 ]
}
The JSON and JNP files do not require JavaScript to read or write because they are in a text format that is language-independent and can be run everywhere. Some of the essential notation elements include:
- Objects: Objects begin and end with curly braces ({}).
- Object Members: Members consist of strings and values that are comma (,) separated.
- Arrays: Arrays begin and end with braces and contain different values.
- Values: A value can be a string, object, array, number, Boolean, or null.
You can see some of the other new file formats here.