shakyground2 merge requestshttps://git.gfz-potsdam.de/shakemap/shakyground2/-/merge_requests2022-05-31T08:59:24+02:00https://git.gfz-potsdam.de/shakemap/shakyground2/-/merge_requests/36Fixes bug in quakeml reader, wrong magnitudes2022-05-31T08:59:24+02:00Graeme WeatherillFixes bug in quakeml reader, wrong magnitudesAddresses https://git.gfz-potsdam.de/shakemap/shakyground2/-/issues/29
The quakeml reader was returning the magnitude corresponding to the last in the QuakeML file rather than the preferred magnitude. This MR fixes this to ensure that t...Addresses https://git.gfz-potsdam.de/shakemap/shakyground2/-/issues/29
The quakeml reader was returning the magnitude corresponding to the last in the QuakeML file rather than the preferred magnitude. This MR fixes this to ensure that the preferred magnitude is returned.Graeme WeatherillGraeme Weatherillhttps://git.gfz-potsdam.de/shakemap/shakyground2/-/merge_requests/35Bumps black to 22.3.0, fixes OQ to 3.13.02022-05-05T11:11:48+02:00Graeme WeatherillBumps black to 22.3.0, fixes OQ to 3.13.0https://git.gfz-potsdam.de/shakemap/shakyground2/-/merge_requests/34Set explicit maximum distance for OQ ContextMaker2022-03-31T15:58:39+02:00Graeme WeatherillSet explicit maximum distance for OQ ContextMakerFixes problem of different number of sites input into GMM than expected (as mentioned in the thread here: https://git.gfz-potsdam.de/shakemap/shakyground2/-/issues/25)
Recent changes in OpenQuake meant that a default maximum distance of...Fixes problem of different number of sites input into GMM than expected (as mentioned in the thread here: https://git.gfz-potsdam.de/shakemap/shakyground2/-/issues/25)
Recent changes in OpenQuake meant that a default maximum distance of 1000 km for the ContextMaker calculations has been introduced when the `maximum_distances` is not specified in the OQ mock config dictionary. For some larger earthquakes the points in the `SiteModel` at the edge of the bounding box were being filtered out and only those within the maximum distance retained. As the pre-allocated array size for the shakemaps is based on the `SiteModel` size, this meant that ground motions were being calculated at fewer sites than expected; hence the array size mismatch.
This MR sets an explicit maximum distance of 10,000 km for the `ContextMaker`, which should avoid the problem for all conceivable earthquake magnitudes.
A couple of minor edits were added to remove some warnings regarding deprecated numpy datatype usage (e.g. np.float, np.bool etc), and a black fix.Graeme WeatherillGraeme Weatherillhttps://git.gfz-potsdam.de/shakemap/shakyground2/-/merge_requests/32Bug/oq change dec20212022-02-07T09:01:17+01:00Graeme WeatherillBug/oq change dec2021More upstream changes to the `openquake.hazardlib.contexts.ContextMaker` class broke the Shakemap calculator (yet again!). Fundamentally now one cannot work with the three separate contexts (RuptureContext, SitesContext, DistancesContext...More upstream changes to the `openquake.hazardlib.contexts.ContextMaker` class broke the Shakemap calculator (yet again!). Fundamentally now one cannot work with the three separate contexts (RuptureContext, SitesContext, DistancesContext) but with the single context object. Trying to keep changes to a minimum I am still calling the GMPEs themselves with three inputs (now just the context object repeated), which is still supported by OpenQuake specifically for this backward compatibility, even if it is inelegant.Graeme WeatherillGraeme Weatherillhttps://git.gfz-potsdam.de/shakemap/shakyground2/-/merge_requests/28Small edit to adapt to OQ changes, fixes broken quakeml test2021-10-05T08:17:34+02:00Graeme WeatherillSmall edit to adapt to OQ changes, fixes broken quakeml testIn the last few months OQ has made some API changes to its ground motion model library, as explained here: https://git.gfz-potsdam.de/shakemap/shakyground2/-/issues/25. This has caused some breakages in this library (and other libraries ...In the last few months OQ has made some API changes to its ground motion model library, as explained here: https://git.gfz-potsdam.de/shakemap/shakyground2/-/issues/25. This has caused some breakages in this library (and other libraries that use OQ's GMMs for this purpose). At present, shakyground2's shakemap calculator is using the `openquake.hazardlib.contexts.ContextMaker` class for preparing the inputs to the GMM, but calling the GMMs themselves according to the old style API. After some user feedback, OpenQuake's developers have ensured that OpenQuake's old style GMM remains backward compatible for the time being, so only one small change was needed to keep shakyground2 working with the 3.12.0 release of OpenQuake. This is implemented here along with some minor cleanup of formatting to address a `line too long` formatting error from Flake8.
Also, a small change in the precision of the magnitude and location of one of the GEOFON test events seemed to have occurred, so the test have been edited to fix this too.https://git.gfz-potsdam.de/shakemap/shakyground2/-/merge_requests/22(Potentially) Fixes bug of shakemaps not working across antimeridian2021-06-02T14:22:36+02:00Graeme Weatherill(Potentially) Fixes bug of shakemaps not working across antimeridianAddresses https://git.gfz-potsdam.de/shakemap/shakyground2/-/issues/18
when the bounding box of the shakemap region crossed the antimeridian (not the "international date line" - I have been corrected on that terminology!) the shakemap c...Addresses https://git.gfz-potsdam.de/shakemap/shakyground2/-/issues/18
when the bounding box of the shakemap region crossed the antimeridian (not the "international date line" - I have been corrected on that terminology!) the shakemap could not be built. There were several steps in the calculation that prevented it, but it ultimately originates from the `ulon` of the bounding box being lower than the `llon` and thus no valid site model was built. This MR makes the necessary fixes in the shakemap code to ensure that the ground motion values are calculated at the sites correctly when the earthquake is near the antimeridian.
In the second modification, the generation of the raster and contours has been modified. For the contours these are re-centred such that longitudes in the western hemisphere (-180˚E to 0˚E) are shifted to an antimeridian centred system (i.e. 180˚E to 360˚E). Thus the contour can now contain longitudes greater than 180˚E. For the raster we use `rasterio`'s `reproject` functionality to transform the raster passing the `CENTER LONG = 180` keyword to the `GDAL` backend. This does not raise an error and seems to export complete rasters.
Here is an example of the shakemap in QGIS:
![Screen_Shot_2021-05-27_at_16.58.53](/uploads/c5a1c92f27aa186eb8373500fc065d7e/Screen_Shot_2021-05-27_at_16.58.53.png)
@nils @eggi Honestly, I have no idea whether this has worked or not. The results seem OK in QGIS when I set the basemap projection to EPSG:4326, but if I switch to another project (e.g. EPSG:3857) then it only shows me the portion of the raster in the eastern hemisphere. This could be just a QGIS issue, though, and it might be fine on the Earthquake Explorer server. I will keep issue https://git.gfz-potsdam.de/shakemap/shakyground2/-/issues/18 open after merging this MR until there is confirmation that this either i) works directly or ii) can be integrated into the pipeline.
An antimeridian crossing workflow has also been added to the workflow test cases.https://git.gfz-potsdam.de/shakemap/shakyground2/-/merge_requests/21Another fix to the datetime isoformat2021-05-27T09:29:53+02:00Graeme WeatherillAnother fix to the datetime isoformatStill addressing: https://git.gfz-potsdam.de/shakemap/shakyground2/-/issues/22
Changes formatting of the "second" string in the datetime.from_isoformat function. Now adds a test of the `Earthquake.from_quakeml` function that inputs vario...Still addressing: https://git.gfz-potsdam.de/shakemap/shakyground2/-/issues/22
Changes formatting of the "second" string in the datetime.from_isoformat function. Now adds a test of the `Earthquake.from_quakeml` function that inputs various GEOFON event IDs and verifies that the `Earthquake` classes are built correctly.https://git.gfz-potsdam.de/shakemap/shakyground2/-/merge_requests/20Fixes datetime formatting and adds new error for FDSN failure2021-05-26T17:21:17+02:00Graeme WeatherillFixes datetime formatting and adds new error for FDSN failure1. Fixes the datetime formatting error mentioned here: https://git.gfz-potsdam.de/shakemap/shakyground2/-/issues/22
2. Raises an `HTTPException` when the FDSN web service is not available (or not found) for a certain event. As raised he...1. Fixes the datetime formatting error mentioned here: https://git.gfz-potsdam.de/shakemap/shakyground2/-/issues/22
2. Raises an `HTTPException` when the FDSN web service is not available (or not found) for a certain event. As raised here: https://git.gfz-potsdam.de/shakemap/shakyground2/-/issues/23