rizac / gfzreport

A sphinx-based report generation for use at gfz
GNU General Public License v3.0
0 stars 1 forks source link

Stations receive empty marker colour in figure, empty Sensor in table #8

Closed pevans-gfz closed 4 years ago

pevans-gfz commented 4 years ago

Consider network 5M:2015 on the Cape Verde islands. Here the channel-level metadata, text shows two sensor types, SM-6/ and Trillium-Compact.

5M|CV08||EHZ|14.866483|-24.3525|778.0|0.0|0.0|-90.0|GFZ:5M2015:SM-6/g=28|1887436800.0|4.5|M/S|200.0|2016-01-15T13:05:00|2016-12-30T00:00:00
5M|CV09||EHZ|14.865133|-24.349983|751.0|0.0|0.0|-90.0|GFZ:5M2015:SM-6/g=28|1887436800.0|4.5|M/S|200.0|2015-10-08T00:00:00|2016-12-29T00:00:00
5M|CV10||HHZ|14.928444|-24.3595|1793.0|0.0|0.0|-90.0|GFZ:5M2015:Trillium-Compact/g=750|4915200000.0|1.0|M/S|200.0|2016-01-16T00:00:00|2016-12-29T00:00:00
5M|CV11||HHZ|15.041919|-24.369489|376.0|0.0|0.0|-90.0|GFZ:5M2015:Trillium-Compact/g=750|4915200000.0|1.0|M/S|200.0|2016-01-18T00:00:00|2016-07-21T13:30:00
5M|CV11||HHZ|15.039717|-24.370683|414.0|0.0|0.0|-90.0|GFZ:5M2015:Trillium-Compact/g=750|4915200000.0|1.0|M/S|200.0|2016-07-21T13:50:00|2016-12-31T00:00:00
5M|CV12||HHZ|14.92295|-24.48345|351.0|0.0|0.0|-90.0|GFZ:5M2015:Trillium-Compact/g=750|4915200000.0|1.0|M/S|200.0|2016-01-18T00:00:00|2016-12-31T00:00:00

(metadata request)

The rendered report.rst then has two problems which show up for the Trillium-Compact stations:

  1. displays {{ stations_table.content }} with Sensor = " " (a space with double quotes) in Table 1 (the station table), not "Trillium-Compact"
  2. displays {{ stations_map.content }} with empty Color in Fig 1. report.rst has:
    
    Label Lat Lon Marker Color Legend
    CV08 14.866483 -24.3525 s #FF0000 
    CV09 14.865133 -24.349983 s #FF0000 
    CV10 14.928444 -24.3595 s  
    CV11 15.041919 -24.369489 s  
    CV11 15.039717 -24.370683 s  
    CV12 14.92295 -24.48345 s  
    MLOS 14.97596 -24.33798 o #FFFFFF00 "YW 2002-2004"
    PATM 14.86933 -24.42407 o #FFFFFF00 


As a result, the three station triangles for CV10, CV11, CV12 are missing on the map, and the user is unhappy. CV03 *does* show on the map, because it has an epoch in which the Sensor is SM-6. But the table 
pevans-gfz commented 4 years ago

It looks like

  1. comes from geofonstations_df() in core/__init.py, which eventually populates {{ stations_table.content }}
  2. then comes from get_map_df() in core/init.py which is called to populate {{ stations_map.content }}

and the data frames geofon_df and map_df get converted to CSV which doesn't contain the necessary values.

pevans-gfz commented 4 years ago

And the empty string came about because our XML metadata for this network didn't contain a <Model> sub-element of <Sensor> for the Compacts. But it did have <Model>SM-6</Model> for the SM-6 <Sensor> elements. So in geofonstations_df():

mydic['Sensor'] = cha.sensor.model

filled with either None or "". Which somehow broke the colour assignment code.

As a workaround, we changed our metadata for this station. It would be good to have a quick test that this changed the resulting RST without having to redo the whole report.

rizac commented 4 years ago

Ok then I will add a test on that metadata checking that everything is as expected right?

(ps: Undergoing a migration to a new macos ;-) probably needing some days)

pevans-gfz commented 4 years ago

On 01.10.20 17:16, Riccardo Zaccarelli wrote:

Ok then I will add a test on that metadata checking that everything is as expected right?

Right. I would expect if there's an empty model, then that gets exposed as another category for symbols on the map. Not that stations disappear.

No hurry.

-- Dr Peter L. Evans, Section 2.4 Seismology GFZ German Research Centre for Geosciences pevans@gfz-potsdam.de Tel. +49 (0)331 288-1261 http://geofon.gfz-potsdam.de/ Fax: +49 (0)331 288-1277

rizac commented 4 years ago

Then would it be enough to write:

mydic['Sensor'] = cha.sensor.model or 'unknown sensor model'

(asking why it looks simple but maybe I did not get something)

Btw, out of curiosity: I guess you can regenerate the report then and see the result (the report on the server seems to be still unedited, it can be regenerated easily right?)

pevans-gfz commented 4 years ago

On 13.10.20 14:36, Riccardo Zaccarelli wrote:

Then would it be enough to write:

mydic['Sensor'] = cha.sensor.model or 'unknown sensor model'

I think so. Then 'unknown sensor model' would show up in the table, the station would show up on the map with some sort of symbol, and the report generating human ("RGH"??) would see there's a problem right away.