ecmwf / skinnywms

Lightweight WMS server for serving maps of netCDF and GRIB data
Apache License 2.0
47 stars 22 forks source link

documentation for creating custom styles #37

Open brancomat opened 4 years ago

brancomat commented 4 years ago

If I understand correctly, skinnywms uses magics' default styles in /usr/share/magics/styles/, but it's possible to use a different path with the --style parameter.

Is there any documentation or best practices for the json files in that directory? Particularly on matching products/levels with the desired style. It seems that there are generic style (contour) definitions and other files with a match between a combination of levels/parameters and those styles.

Thank you.

sylvielamythepaut commented 4 years ago

Hi, Yes exactly ii is possible to create some json files with rules and styles and have Magics to use them in the skinny wms .. I am going to create a repo on github with exmaples a "tiny" bit of documentation Sylvie

brancomat commented 4 years ago

Thank you, in the meantime we tried to boil down our generic question to a couple of more specific points:

  1. how are json styles file read? are there specific names or hierarchies? A wild guess: when the contour_automatig_setting variable it set it seems to read the default syles and then the subdir with the name of the variable, is it correct?

  2. the semantic of the "match" array, i.e. how to express logical and/or in matches and what fields is it possibile to use

milanavuckovic commented 4 years ago

Hello, I'll try to answer your questions:

  1. When contour_automatic_setting variable is set to 'ecmwf', Magics will read the metadata and try to find matches in json files (we call them layers, because they originate from ecCharts layers). If it finds something with at least one match it will use the default (first in the list) style from the list of styles.
  2. "match" is a list of dictionaries. In order for the layer to be 'matched', all the parameters in one dictionary must match. So it's dict1 OR dict2 OR dict3 etc. If a value in dictionary element is a list then one element in that list must mach. For example "match": [ { "paramId": "34", "shortName": "sst" }, { "long_name": "Sea surface temperature" }, { "standard_name": [ "sea_surface_temperature", "sea_surface_skin_temperature" ] In order to be matched here it needs to have in its metadata:
    • paramId = 34 AND shortName = sst OR
    • 'long_name' = 'Sea surface temperature' OR
    • 'standard_name' = sea_surface_temperature OR sea_surface_skin_temperature I hope this helps, Milana
tnlogy commented 2 years ago

Any progress with showing a minimal example of using custom styles? Tried setting the arguments to Styler, but no changes visible. Any example on how to make a custom style for a shortName in a grib file would be much appreciated.

Also tried with setting MAGICS_STYLE_PATH to a path with some styles, but no difference.