Skip to content
Snippets Groups Projects
Commit 54d60a1c authored by Clayton, Brandon Scott's avatar Clayton, Brandon Scott
Browse files

Match to dynamic response

parent f5fd7b5d
No related branches found
No related tags found
2 merge requests!101Production Release | nshmp-ws-static,!99Update Usage
......@@ -2,17 +2,18 @@ package gov.usgs.earthquake.nshmp.netcdf.www;
import static gov.usgs.earthquake.nshmp.netcdf.www.NetcdfWsUtils.GSON;
import java.util.List;
import java.util.Map;
import java.util.logging.Logger;
import gov.usgs.earthquake.nshmp.Maths;
import gov.usgs.earthquake.nshmp.data.XySequence;
import gov.usgs.earthquake.nshmp.geo.Bounds;
import gov.usgs.earthquake.nshmp.geo.Location;
import gov.usgs.earthquake.nshmp.gmm.NehrpSiteClass;
import gov.usgs.earthquake.nshmp.netcdf.Netcdf;
import gov.usgs.earthquake.nshmp.netcdf.data.ScienceBaseMetadata;
import gov.usgs.earthquake.nshmp.netcdf.www.NetcdfController.Query;
import gov.usgs.earthquake.nshmp.netcdf.www.NetcdfController.Service;
import gov.usgs.earthquake.nshmp.netcdf.www.meta.DoubleParameter;
import gov.usgs.earthquake.nshmp.www.Response;
import io.micronaut.http.HttpRequest;
......@@ -126,7 +127,7 @@ public abstract class NetcdfService {
final String description;
final String[] syntax;
final String netcdfFile;
final Parameters parameters;
final Parameters model;
final ScienceBaseMetadata scienceBaseMetadata;
Metadata(HttpRequest<?> request, String description) {
......@@ -134,25 +135,45 @@ public abstract class NetcdfService {
url = url.endsWith("/") ? url.substring(0, url.length() - 1) : url;
this.description = description;
scienceBaseMetadata = netcdf().netcdfData().scienceBaseMetadata();
netcdfFile = netcdf().netcdfPath().toString();
netcdfFile = netcdf().netcdfPath().getFileName().toString();
syntax = new String[] {
url + "/{longitude:number}/{latitude:number}",
url + "?longitude={number}&latitude={number}",
url + "/{longitude:number}/{latitude:number}/{siteClass:NehrpSiteClass}",
url + "?longitude={number}&latitude={number}&siteClass={NehrpSiteClass}",
};
parameters = new Parameters();
model = new Parameters();
}
}
class Parameters {
final Bounds bounds;
final List<NehrpSiteClass> siteClasses;
final String name;
final DoubleParameter longitude;
final DoubleParameter latitude;
final Map<NehrpSiteClass, Double> siteClasses;
final DoubleParameter vs30;
Parameters() {
var coordinates = netcdf().netcdfData();
bounds = coordinates.bounds();
siteClasses = coordinates.siteClasses();
var netcdfData = netcdf().netcdfData();
var bounds = netcdfData.bounds();
name = netcdfData.scienceBaseMetadata().label;
longitude = new DoubleParameter(
"Longitude",
"°",
Maths.round(bounds.min.longitude, 3),
Maths.round(bounds.max.longitude, 3));
latitude = new DoubleParameter(
"Latitude",
"°",
Maths.round(bounds.min.latitude, 3),
Maths.round(bounds.max.latitude, 3));
siteClasses = netcdfData.vs30Map();
vs30 = new DoubleParameter(
"Vs30",
"m/s",
150,
1500);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment