Code Monkey home page Code Monkey logo

nshmp-haz-ws's Introduction

nshmp-haz-ws's People

Contributors

bclayton-usgs avatar brandonsclayton avatar emartinez-usgs avatar jmfee-usgs avatar pmpowers-usgs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

nshmp-haz-ws's Issues

Circular reference Metadata-Edition

When calling hazard service first time, a circular reference between Metadata and the Edition enum throws an exception. Oddly, a usage request does not, and subsequent calculation requests are processed.

Version information should be moved out to it's own class.

Restructure htdocs

The webapp directory is filling up and will continue to do so. We might consider moving all html files and supporting folders down into an apps directory. There would only need to be index.html in the web app directory. Alternatively it may be possible to specify:

	<welcome-file-list>
		<welcome-file>apps/index.html</welcome-file>
	</welcome-file-list>

and keep all html in the apps directory, but I'm not sure if the above will work.

Handle updates to vs30-siteClass values

Should we handle SiteClass instead of Vs30, or just both (parse number --> parse enum)?

Sanaz's updated values (adapted from Kircher):
1080 760 530 365 260 185 (m/s)

WUS-CEUS combined config for deagg is inconsistent with hazard

Hazard in the CEUS-WUS overap zone is calculated using the configs of the two models. However, when merging the models, the combined model inherits the config of the first supplied model. This means that for deagg, the incorrect exceedance model may be used (e.g. TRUNCATION_3SIGMA_UPPER vs NSHM_CEUS_MAX_INTENSITY).

However, the CEUS exceedance model generally applies 3ฯƒ truncation everywhere away from New Madrid so it is okay to use TRUNCATION_3SIGMA_UPPER in the overlap zone. This requires that when merging the WUS model is listed first.

Update to current nshmp-haz

Numerous changes to nshmp-haz, including the addition of deaggregation, have left the ws repository out of sync.

Completion of this issue requires deagg JSON output.

Fix limited western U.S. period support

The latest expansion of the hazard web service to support more periods works well, but, like the static services (UHT usgs/earthquake-hazard-tool#272), selection of vs760, west of -115, causes web service requests to specify COUS, which in turn restricts the number of spectral periods supported when processing the imt=any argument.

Server config

Per recent discussion, add the ability to override static and dynamic server settings (and perhaps other settings in the future) via a config.json file. File would also be added to .gitignore.

COUS Model

If the web application determines the model should be COUS, the web service seems not to know how to handle it...

java.lang.IllegalArgumentException: No enum constant gov.usgs.earthquake.nshm.www.services.Model.COUS_2008
    at java.lang.Enum.valueOf(Enum.java:236)
    at gov.usgs.earthquake.nshm.www.services.Model.valueOf(Model.java:10)
    at gov.usgs.earthquake.nshm.www.services.HazardCurve.processCalculation(HazardCurve.java:140)
    at gov.usgs.earthquake.nshm.www.services.HazardCurve.doGet(HazardCurve.java:97)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.filters.CorsFilter.handleSimpleCORS(CorsFilter.java:301)
    at org.apache.catalina.filters.CorsFilter.doFilter(CorsFilter.java:165)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:617)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:668)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1527)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1484)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:745)

Not sure about best method to resolve this since there is no "COUS_*" model repo.

Update documentation

On main tomcat page for webapp... http://host:port/nshmp-haz-ws/

Returns HTML describing the "HazardCurve" endpoint. This has been renamed to "hazard". Also add documentation for deaggregation.

The "syntax" usage described on the endpoint documentation page also suggests "HazardCurve", which breaks. Similarly, the syntax usage described on the "deagg" endpoint seems to refer to "Deagg" instead. This should all be consistent.

Add support for more periods

COUS: PGA, 0.1s, 0.2s, 0.3s, 0.5s, 0.75s, 1.0s, 2.0s, 3.0s, 5.0s
(superset supported by WUS and CEUS models)

AK: PGA, 0.1s, 0.2s, 0.3s, 0.5s, 1.0s, 2.0s

Rename and update index and dashboard pages

Rename:

  • index.html --> services.html
  • dashboard.html --> index.html

Add panel to dashboard pointing to the services documentation page.
Consider if/how to merge other application documentation.
Update header (and footer?) on index page to match

Geographic deagg

Create a plot that uses D3 satellite projection to:

  • present aerial view of users site (centered)
  • view to north
  • draw SINGLE contributors from deagg service JSON as vertical bars; height = contribution

Address zip exceptions

Currently when deploying a packed WAR file to dev and prod systems, a zip error occurs (see trace below). It's not clear what changed to cause this to start occurring.

One possible solution is to not pack the models in zip files during a build (ant: zipfileset); there's no real benefit to doing so.

com.google.common.util.concurrent.UncheckedExecutionException: com.google.gson.JsonIOException: java.util.zip.ZipException: invalid stored block lengths (see logs)
...
java.util.concurrent.ExecutionException:
com.google.common.util.concurrent.UncheckedExecutionException: com.google.gson.JsonIOException: java.util.zip.ZipException: invalid stored block lengths
...
org.opensha2.eq.model.ModelConfig$Builder.fromFile(ModelConfig.java:140)
org.opensha2.eq.model.Loader.load(Loader.java:90) org.opensha2.eq.model.HazardModel.load(HazardModel.java:86)
gov.usgs.earthquake.nshm.www.ServletUtil.loadModel(ServletUtil.java:156) gov.usgs.earthquake.nshm.www.ServletUtil.access$000(ServletUtil.java:49) gov.usgs.earthquake.nshm.www.ServletUtil$1.load(ServletUtil.java:97) gov.usgs.earthquake.nshm.www.ServletUtil$1.load(ServletUtil.java:94)

Fix version reporting

It looks like when nshmp-haz-ws is built, the call to git describe when building nshmp-haz is being executed in the nshmp-haz-ws directory as the app.version key in both app.properties (in nshmp-haz.jar root) and service.properties (in WEB-INF/classes) have the same value. Moreover, even though the values ar the same, the "service" JSON metadata element does not appear to be picking up the nshmp-haz-ws version.

Develop hanging-wall term plotter

Per discussion, this plotter would be similar to GM v. Distance, with some differences:

  • x-axis is fixed in linear space
  • x-axis range: [-20, 100]
  • lower pane with cross-section of fault being modeled

Include pre-build version update script

Add script to repostitory that will read a properties file and update required repos to specified tags. Understand that this script could locally delete itself if the nshmp-haz-ws version specified in the properties file predates the release.

Allow vs30 values to pass through services

For consistency in the earthquake-hazard-tool, nshmp-haz-ws specifies finite vs30 values that each model supports. In regions like the WUS, there is a strong demand to use values outside those specified.

If region==WUS, allow any vs30 between min and max to pass through despite not matching a metadata Vs30 enum value.

Create ground motion v. distance plotter and associated web-service

Application assumes a vertical strike slip fault, normal to the line of section. Will work similar to spectra plot. Requirements:

  • As with spectra-plot, multiple GMMs may be selected
  • Comment out (starting from spectra-plot):
    • Event Parameters EXCEPT Mw; other parameters fixed and sent to service for now
    • Path parameters (these will not be sent to service in lieu of rMin = 0, rMax = 300 fixed and hidden)
    • Source Geometry (these WILL be sent to service)

There are two possible variants of this tool that can be developed from the base case above:

  • Support multiple magnitudes
  • Support multiple Vs30

Further to the above, there is a variant that plots the fault below the data and permits studying geometric and hanging wall effects.

Update IMT labels

Currently they are displayed as:

  • "Peak ground acceleration"
  • "0.2 sec spectral acceleration"
  • "1.0 sec spectral acceleration"

For consistency, these should be:

  • "Peak Ground Acceleration"
  • "0.20 Second Spectral Acceleration"
  • "1.00 Second Spectral Acceleration"

Similar updates for other periods, currently only these three are supported... (?)

CORS Headers

Currently it appear the CORS headers are configured to use the defaults (which is to allow everything). This is okay by me, but the issue I'm having is while the header configuration for allowed origins is "*", the actual header value returned mirrors that of the request referrer host/protocol/port.

The issue with this is that in practice these responses are cached (headers and all) and we do not vary on the access-control-allow-origins header. In this way requests from different referrers for the same resources may causes XHR requests to fail as the returned allowed origin header may not match the request referrer header when the XHR is served by a cached response.

This is unlikely to often affect public requests unless web service requests become popular with external developers. This will affect developers regularly.

Derive metadata from models

Currently, most metadata supplied to services is manually managed; this is due, in part, to the fact that models only load on demand. We should consider returning a usage string derived from available models, but this will require auto-loading all models, which will slow startup time.

Add ability to deploy WAR file locally

To streamline local development internal use of nshmp-haz, add deploy step to build.xml conditioned on the deploy destination being defined as a property.

MFD Plotter

Create an MFD plotter to further support source model mining, and to support enhancements down the road to the fault source parameter dB pages. This requires backfilling source ID's consistent with fault source param dB tables and the ability to collapse logic-tree branch MFDs to a total MFD.

See also usgs/nshmp-haz#287

Add version info to any response

  • Application version data is currently returned with 'usage' JSON; should also be included in any response. Model versions are reported in both.
  • In addition, add the url to the repository being referred to.
  • In production, application and model versions will be release tags (e.g. v1.0.0). In development, 'git describe' returns the most recent tag, the number of commits the repo is ahead of that tag, and the hash of the most recent commit. Consider breaking this down to just the hash for development.

Add metadata to plotting apps

Per discussion, we agreed to add a third tab to plot windows that would:

  • display/reflect prettified (key-value pairs rendered across a few columns) of the arguments supplied to the backing web-service.
  • Include the URL that could be used to generate the page (although the above parameters are included in the URL, they are difficult to visually isolate).
  • display/reflect the code versions being used; these can be obtained from the "server" element at the root of the response and should be rendered as, e.g., nshmp-haz: v1.2.0-17-g2b25de4.

Also consider adding flag to print process to print metadata, or not.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.