From a99daed255887a2180a0b6f411b77880ee9a27bd Mon Sep 17 00:00:00 2001 From: Paul van Genuchten Date: Sat, 1 Mar 2025 01:00:43 +0100 Subject: [PATCH 1/4] resolves issue #973 add a null check before using attrib --- owslib/iso.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/owslib/iso.py b/owslib/iso.py index 9c3971c5..f4f19f76 100644 --- a/owslib/iso.py +++ b/owslib/iso.py @@ -224,11 +224,14 @@ def __init__(self, md=None): self.charset = None else: self.id = md.attrib.get('id') - self.languagecode = md.find( - util.nspath_eval('gmd:languageCode/gmd:LanguageCode', namespaces)).attrib.get('codeListValue') - self.charset = md.find( - util.nspath_eval('gmd:characterEncoding/gmd:MD_CharacterSetCode', namespaces)).attrib.get( - 'codeListValue') + self.languagecode = None + languagecode = md.find(util.nspath_eval('gmd:languageCode/gmd:LanguageCode', namespaces)) + if languagecode is not None: + self.languagecode = languagecode.attrib.get('codeListValue') + self.charset = None + charset = md.find(util.nspath_eval('gmd:characterEncoding/gmd:MD_CharacterSetCode', namespaces)) + if charset is not None: + self.charset = charset.attrib.get('codeListValue') class CI_Date(object): From f78b9cf5158ae272021ad110bb146b53c0135d68 Mon Sep 17 00:00:00 2001 From: sethg Date: Thu, 6 Mar 2025 22:22:56 +0100 Subject: [PATCH 2/4] Add pytest_httpserver and unit test --- requirements-dev.txt | 1 + .../resources/inspire-getrecords-response.xml | 1947 +++++++++++++++++ tests/test_csw_inspire.py | 60 + 3 files changed, 2008 insertions(+) create mode 100644 tests/resources/inspire-getrecords-response.xml create mode 100644 tests/test_csw_inspire.py diff --git a/requirements-dev.txt b/requirements-dev.txt index 318d435a..785f2e44 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -2,6 +2,7 @@ flake8 pytest pytest-cov +pytest_httpserver pytest-socket Pillow tox diff --git a/tests/resources/inspire-getrecords-response.xml b/tests/resources/inspire-getrecords-response.xml new file mode 100644 index 00000000..b04d4929 --- /dev/null +++ b/tests/resources/inspire-getrecords-response.xml @@ -0,0 +1,1947 @@ + + + + + + 8dad9c98-0512-4845-a2bf-3ace1c93df6f + + + + + + + + + + + + Webmap service + + + + + Floor Van Damme + + + National Geographic Institute + + + National Geographic Institute + + + Institut géographique national + + + Nationaal Geografisch Instituut + + + Nationales geographisches Institut + + + + + + + + + Kortenberglaan 115 + + + Kortenberglaan 115 + + + Avenue de Cortenbergh 115 + + + Kortenberglaan 115 + + + Avenue de Cortenbergh 115 + + + + + Brussels + + + Brussels + + + Bruxelles + + + Brussel + + + Brüssel + + + + + 1000 + + + Belgium + + + Belgium + + + Belgique + + + Belgie + + + Belgien + + + + + metadata@ngi.be + + + + + + + http://www.ngi.be + + + http://www.ngi.be + + + http://www.ngi.be + + + https://www.ngi.be/website/fr/ + + + http://www.ngi.be + + + http://www.ngi.be + + + + + + + + + + + + + + 2024-07-05T13:35:37 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + EPSG:3035 + + + EPSG:3035 + + + + + + + + + + + + + EPSG:4258 + + + EPSG:4258 + + + + + + + + + + + + + EPSG:3857 + + + EPSG:3857 + + + + + + + + + + + + + EPSG:4326 + + + EPSG:4326 + + + + + + + + + + + + + EPSG:3812 + + + EPSG:3812 + + + + + + + + + + + + + SUVIM station network WMS + + + SUVIM station network WMS + + + SUVIM station network WMS + + + SUVIM station network WMS + + + SUVIM station network WMS + + + + + + + 1993-03-29 + + + + + + + + + + 4f8bbdee-f02a-4050-9309-8aa6538ec8cc + + + BE.BIRA-IASB + + + + + + + The Solar Ultraviolet - Visible Irradiance Monitoring network (SUVIM) is formed of observation stations operated by the Royal Belgian Institute for Space Aeronomy (IASB-BIRA). At each station, UV solar radiation is measured by several instruments. The network produces UV indices, solar irradiances and ancillary measurements such as meteorological conditions at the stations in quasi-real time. The SUVIM Station Network dataset includes information on the stations. It does not include the measured data, which form the SUVIM Observations dataset. + + + The Solar Ultraviolet - Visible Irradiance Monitoring network (SUVIM) is formed of observation stations operated by the Royal Belgian Institute for Space Aeronomy (IASB-BIRA). At each station, UV solar radiation is measured by several instruments. The network produces UV indices, solar irradiances and ancillary measurements such as meteorological conditions at the stations in quasi-real time. The SUVIM Station Network dataset includes information on the stations. It does not include the measured data, which form the SUVIM Observations dataset. + + + The Solar Ultraviolet - Visible Irradiance Monitoring network (SUVIM) is formed of observation stations operated by the Royal Belgian Institute for Space Aeronomy (IASB-BIRA). At each station, UV solar radiation is measured by several instruments. The network produces UV indices, solar irradiances and ancillary measurements such as meteorological conditions at the stations in quasi-real time. The SUVIM Station Network dataset includes information on the stations. It does not include the measured data, which form the SUVIM Observations dataset. + + + The Solar Ultraviolet - Visible Irradiance Monitoring network (SUVIM) is formed of observation stations operated by the Royal Belgian Institute for Space Aeronomy (IASB-BIRA). At each station, UV solar radiation is measured by several instruments. The network produces UV indices, solar irradiances and ancillary measurements such as meteorological conditions at the stations in quasi-real time. The SUVIM Station Network dataset includes information on the stations. It does not include the measured data, which form the SUVIM Observations dataset. + + + The Solar Ultraviolet - Visible Irradiance Monitoring network (SUVIM) is formed of observation stations operated by the Royal Belgian Institute for Space Aeronomy (IASB-BIRA). At each station, UV solar radiation is measured by several instruments. The network produces UV indices, solar irradiances and ancillary measurements such as meteorological conditions at the stations in quasi-real time. The SUVIM Station Network dataset includes information on the stations. It does not include the measured data, which form the SUVIM Observations dataset. + + + + + + + National Geographic Institute + + + National Geographic Institute + + + Institut géographique national + + + Nationaal Geografisch Instituut + + + Nationales geographisches Institut + + + + + + + + + Kortenberglaan 115 + + + Kortenberglaan 115 + + + Avenue de Cortenbergh 115 + + + Kortenberglaan 115 + + + Avenue de Cortenbergh 115 + + + + + Brussels + + + Brussels + + + Bruxelles + + + Brussel + + + Brüssel + + + + + 1000 + + + Belgium + + + Belgium + + + Belgique + + + Belgie + + + Belgien + + + + + products@ngi.be + + + + + + + http://www.ngi.be + + + http://www.ngi.be + + + http://www.ngi.be + + + https://www.ngi.be/website/fr/ + + + http://www.ngi.be + + + http://www.ngi.be + + + + + + + + + + + + + + + + https://www.geo.be/thumbs/uv-station-suvim.jpg + + + + + + + Science and technology + + + Science and technology + + + Science et technologie + + + Wetenschap en technologie + + + Wissenschaft und Technologie + + + + + + + + + + Data.gov.be themes + + + Data.gov.be themes + + + + + + + 2019-01-31 + + + + + + + + + + geonetwork.thesaurus.external.theme.datagovthesaurus + + + + + + + + + + + Reporting INSPIRE + + + Reporting INSPIRE + + + Reporting INSPIRE + + + Reporting INSPIRE + + + Reporting INSPIRE + + + + + Meteorology, weather and radiation conditions + + + Meteorology, weather and radiation conditions + + + Météorologie, conditions atmosphériques et radiatives + + + Meteorologie, weers- en stralingsomstandigheden + + + Meteorologie, atmosphärische und Strahlungsbedingungen + + + + + + + + + + Belgian Federal Thesaurus + + + Belgian Federal Thesaurus + + + + + + + 2020-03-01 + + + + + + + + + + geonetwork.thesaurus.external.theme.federalthesaurus + + + + + + + + + + + National + + + National + + + National + + + Nationaal + + + National + + + + + + + + + + Spatial scope + + + Spatial scope + + + + + + + 2019-05-22 + + + + + + + + + + geonetwork.thesaurus.external.theme.httpinspireeceuropaeumetadatacodelistSpatialScope-SpatialScope + + + + + + + + + + + infoMapAccessService + + + infoMapAccessService + + + + + + + Annex D4 of the European Commission Regulation 1205/2008 + + + Annex D4 of the European Commission Regulation 1205/2008 + + + Annexe D4 du règlement 1205/2008 de la commission européenne + + + Bijlage D4 van Verordening 1205/2008 van de Europese Commissie + + + Anhang D4 der Verordnung 1205/2008 der Europäischen Kommission + + + + + + + 2008-12-03 + + + + + + + + + + + + + + atmospheric monitoring + + + atmospheric monitoring + + + + + cancer risk + + + cancer risk + + + + + carcinogenicity + + + carcinogenicity + + + + + dose-effect relationship + + + dose-effect relationship + + + + + environmental health + + + environmental health + + + + + environmental quality + + + environmental quality + + + + + ozone layer + + + ozone layer + + + + + radiation + + + radiation + + + + + solar radiation + + + solar radiation + + + + + stratospheric ozone depletion + + + stratospheric ozone depletion + + + + + ultraviolet radiation + + + ultraviolet radiation + + + + + + + EIONET GEMET Thesaurus Concepts + + + EIONET GEMET Thesaurus Concepts + + + EIONET GEMET Thesaurus Concepts + + + EIONET GEMET Thesaurus Concepts + + + EIONET GEMET Thesaurus Concepts + + + + + + + 2012-07-20 + + + + + + + + V.3.1 + + + + + + + + + solar_irradiance + + + solar_irradiance + + + + + atmosphere_mole_content_of_ozone + + + atmosphere_mole_content_of_ozone + + + + + + + CF Standard Name Table + + + CF Standard Name Table + + + + + + + 2016-03-08 + + + + + + + + V 31 + + + + + + + + + erythemal dose + + + erythemal dose + + + + + direct solar irradiance + + + direct solar irradiance + + + + + UV-A + + + UV-A + + + + + UV-B + + + UV-B + + + + + global UV index + + + global UV index + + + + + ultraviolet radiation + + + ultraviolet radiation + + + + + UV radiation + + + UV radiation + + + + + + + International Commission on Illumination (CIE) + + + International Commission on Illumination (CIE) + + + International Commission on Illumination (CIE) + + + International Commission on Illumination (CIE) + + + International Commission on Illumination (CIE) + + + + + + + 2014 + + + + + + + + + + + + + + Atmospheric conditions + + + Atmospheric conditions + + + Conditions atmosphériques + + + Atmosferische omstandigheden + + + Atmosphärische Bedingungen + + + + + Environmental monitoring facilities + + + Environmental monitoring facilities + + + Installations de suivi environnemental + + + Milieubewakingsvoorzieningen + + + Umweltüberwachung + + + + + Human health and safety + + + Human health and safety + + + Santé et sécurité des personnes + + + Menselijke gezondheid en veiligheid + + + Gesundheit und Sicherheit + + + + + + + + + + GEMET - INSPIRE themes, version 1.0 + + + GEMET - INSPIRE themes, version 1.0 + + + + + + + 2008-06-01 + + + + + + + + + + geonetwork.thesaurus.external.theme.httpinspireeceuropaeutheme-theme + + + + + + + + + + + antarctica + + + antarctica + + + + + + + + + + CF list of Standardized Region Names + + + CF list of Standardized Region Names + + + CF list of Standardized Region Names + + + CF list of Standardized Region Names + + + CF list of Standardized Region Names + + + + + + + 2016 + + + + + + + + + + + + + + Belgium + + + Belgium + + + + + Luxembourg + + + Luxembourg + + + + + Antarctica + + + Antarctica + + + + + + + + + + Getty Thesaurus of Geographic Names (TGN) + + + Getty Thesaurus of Geographic Names (TGN) + + + Getty Thesaurus of Geographic Names (TGN) + + + Getty Thesaurus of Geographic Names (TGN) + + + Getty Thesaurus of Geographic Names (TGN) + + + + + + + 2014-08-12 + + + + + + + + + + + + + + Federal viewer + + + Federal viewer + + + + + + + + + + + + federal government + + + federal government + + + gouvernement fédéral + + + federale regering + + + Bundesregierung + + + + + + + + + + GEMET - Concept themes, version 4.01 + + + GEMET - Concept themes, version 4.01 + + + + + + + 2012-07-20 + + + + + + + + + + geonetwork.thesaurus.external.theme.gemet + + + + + + + + + + + •The custodian of the resource holds the rights of property (including the rights of intellectual property) to the geographic files •The custodian grants the user the right to use the data for his internal use. •Commercial use of the data under any form is strictly forbidden •Custodian’s name must be mentioned each time the data are being used publically. + + + •The custodian of the resource holds the rights of property (including the rights of intellectual property) to the geographic files •The custodian grants the user the right to use the data for his internal use. •Commercial use of the data under any form is strictly forbidden •Custodian’s name must be mentioned each time the data are being used publically. + + + • Le gestionnaire du jeu de données tel qu’il est défini plus haut possède les droits de propriété (y compris les droits de propriété intellectuelle) se rapportant aux fichiers. • Le gestionnaire accorde au client le droit d’utiliser les données pour son usage interne. • L’usage des données à des fins commerciales, sous quelque forme que ce soit, est formellement interdit. • Le nom du gestionnaire doit apparaître lors de chaque utilisation publique des données. + + + •De beheerder van de bron bezit de eigendomsrechten (ook de rechten op de intellectuele eigendom) op de geografische bestanden • De beheerder geeft de klant het recht de gegevens te gebruiken voor intern gebruik •Het commercieel gebruik van de gegevens onder welke vorm dan ook is strikt verboden •De naam van de beheerder moet elke keer vermeld worden als de gegevens publiek gebruikt worden. + + + •De beheerder van de bron bezit de eigendomsrechten (ook de rechten op de intellectuele eigendom) op de geografische bestanden • De beheerder geeft de klant het recht de gegevens te gebruiken voor intern gebruik •Het commercieel gebruik van de gegevens onder welke vorm dan ook is strikt verboden •De naam van de beheerder moet elke keer vermeld worden als de gegevens publiek gebruikt worden. + + + + + + + + + + + + No limitations on public access + + + No limitations on public access + + + Pas de restrictions concernant l'accès public + + + Geen beperkingen op openbare toegang + + + Öffentliche Zugang nicht beschränkt + + + + + + + + + + + + •The custodian of the resource holds the rights of property (including the rights of intellectual property) to the geographic files •The custodian grants the user the right to use the data for his internal use. •Commercial use of the data under any form is strictly forbidden •Custodian’s name must be mentioned each time the data are being used publically. + + + •The custodian of the resource holds the rights of property (including the rights of intellectual property) to the geographic files •The custodian grants the user the right to use the data for his internal use. •Commercial use of the data under any form is strictly forbidden •Custodian’s name must be mentioned each time the data are being used publically. + + + • Le gestionnaire du jeu de données tel qu’il est défini plus haut possède les droits de propriété (y compris les droits de propriété intellectuelle) se rapportant aux fichiers. • Le gestionnaire accorde au client le droit d’utiliser les données pour son usage interne. • L’usage des données à des fins commerciales, sous quelque forme que ce soit, est formellement interdit. • Le nom du gestionnaire doit apparaître lors de chaque utilisation publique des données. + + + •De beheerder van de bron bezit de eigendomsrechten (ook de rechten op de intellectuele eigendom) op de geografische bestanden • De beheerder geeft de klant het recht de gegevens te gebruiken voor intern gebruik •Het commercieel gebruik van de gegevens onder welke vorm dan ook is strikt verboden •De naam van de beheerder moet elke keer vermeld worden als de gegevens publiek gebruikt worden. + + + • Der Datensatzverwalter wie höher beschrieben besitzt die Eigentumsrechte (geistiges Eigentum einbegriffen) über die Dateien.• Der Verwalter gewährt dem Kunden das Recht, die Daten intern zu benutzen.• Die Daten zu irgendwelchen kommerziellen Zwecken zu benutzen ist strikt verboten.• Der Name des Verwalters muss bei jeder öffentlichen Benutzung der Daten gemeldet werden. + + + + + + + view + + + + + + + + + GetCapabilities + + + + + + + + + https://wms.ngi.be/inspire/aeronomie/service + + + OGC:WMS + + + + + + + + + + + + + + + + https://wms.ngi.be/inspire/aeronomie/service?request=GetCapabilities&service=WMS&version=1.3.0 + + + OGC:WMS + + + view + + + View service + + + View service + + + Service de visualisation + + + Raadpleegdienst + + + Darstellungsdienste + + + + + + + + + + + + + + + + + + + + + + + Wemap service + + + + + + + + + INSPIRE Conformity + + + INSPIRE Conformity + + + Conformité INSPIRE + + + INSPIRE Conformiteit + + + INSPIRE Konformität + + + + + + + + + COMMISSION REGULATION (EU) No 976/2009 of 19 October 2009 implementing Directive 2007/2/EC of the European Parliament and of the Council as regards the Network Services + + + COMMISSION REGULATION (EU) No 976/2009 of 19 October 2009 implementing Directive 2007/2/EC of the European Parliament and of the Council as regards the Network Services + + + Règlement (UE) N° 976/2009 de la Commission du 19 octobre 2009 portant modalités d'application de la directive 2007/2/CE du Parlement européen et du Conseil en ce qui concerne les services en réseau + + + Verordening (EU) n r. 976/2009 van de Commissie van 19 oktober 2009 tot uitvoering van Richtlijn 2007/2/EG van het Europees Parlement en de Raad wat betreft de netwerkdiensten + + + Verordnung (EG) Nr. 976/2009 der Kommission vom 19. Oktober 2009 zur Durchführung der Richtlinie 2007/2/EG des Europäischen Parlaments und des Rates hinsichtlich der Netzdienste + + + + + + + 2009-08-19 + + + + + + + + + + The service described meets the technical requirements as defined by the Commission Regulation (EC) No 976/2009 of 19 October 2009 + + + The service described meets the technical requirements as defined by the Commission Regulation (EC) No 976/2009 of 19 October 2009 + + + Le service décrit répond aux exigences techniques telles qu’elles sont définies par le Règlement (UE) n° 976/2009 de la Commission du 19 octobre 2009 + + + De beschreven service voldoet aan de technische vereisten zoals bepaald in de Verordening (EC) nr 976/2009 van de Commissie van 19 oktober 2009 + + + Der beschriebene Dienst entspricht den technischen Anforderungen wie bestimmt in der Verordnung (EG) Nr. 976/2009 der Kommission vom 19. Oktober 2009 + + + + + true + + + + + + + + + + Archives: + The SUVIM Observations data are archived at (and are available from) + 1. the Royal Belgian Institute for Space Aeronomy (IASB-BIRA) – http://uvindex.aeronomie.be/ + 2. the European UV Database – http://uv.fmi.fi/uvdb/ + + History of instruments in operation at each station in Belgium and type of data available: + IASB-BIRA – Uccle (BRU) + 1. Spectral data (Global Solar Spectral Irradiance) + Wavelength range : 280 -600 nm + Field of view : 2 pi sr + Period : since March 29, 1993 + 2. Broadband data + UV-B meter (total) since February 2, 1995 + UV-B meter (diffuse) since July 16, 1996 + UV-A meter since May 11, 1995 + pyranometer since July 25, 1995 + 3. Filter radiometradata + 10-Channels SPUV-10 since March 21, 1996 + 7-Channels UVMFR-7 since October 14, 1999 + 7-Channels MFR-7 since December 18, 2003 + 5-Channels GUV-551C since May 23, 1996 + 6-Channels GUV-2511 since June 3, 2005 + 4. Cloud measurements + TSI (Total Sky Imager) since December 7, 1999 + CIR (Cloud Infrared Radiometer) since March 1, 2002 + 5. Meteorological measurements + Eole 100/200 since May 27, 1997 + 6. Sunshine Duration + SDM MS-093 since June 16, 2010 + + Euro Space Center – REDU (RED) + 1. Broadband data UV-B meter since June 15, 2004 + UV-A meter since June 15, 2004 + Pyranometer since June 15, 2004 + 2. Filter radiometer data 5-Channels GUV 511c since March 10, 2005 + 3. Cloud measurements CIR-4 /CIR-4V since December 7, 2006 + 4. Meteorological measurements Eole 200 since March 3, 2005 + 5. Sunshine Duration SDM MS-093 since August 1, 2011 + + Earth Explorer – Ostend (LIT) + 1. Broadband data UV-B meter since April 4, 2006 + UV-A meter since April 4, 2006 + Pyranometer since April 4, 2006 + 2. Filter radiometer data 6-Channels GUV 2511 since June 26, 2006 + 3. Cloud measurements CIR-4/CIR-4V since December 21, 2006 + 4. Meteorological measurements Eole 200 since April 4, 2006 + + Virton – City Hall (GAU) + 1. Broadband data UV-B meter since December 11, 2007 + UV-A meter since December 11, 2007 + Pyranometer since December 11, 2007 + 2. Filter radiometer data 6-Channels GUV 2511 since February 19, 2008 + 3. Cloud measurements CIR-4/CIR-4V since December 11, 2007 + 4. Meteorological measurements Eole 200 since December 11, 2007 + + VITO – Mol (CAM) + 1. Broadband data UV-B meter since December 16, 2008 + UV-A meter since December 16, 2008 + Pyranometer since December 16, 2008 + 2. Filter radiometer data 6-Channels GUV 2511 since February 19, 2008 + 3. Cloud measurements CIR-4/CIR-4V since December 16, 2008 + 4. Meteorological measurements Eole 200 since December 16, 2008 + + Hautes Fagnes Scientific Station - Mont Rigi (FAG) + 1. Broadband data UV-B meter since November 8, 2011 + UV-A meter since November 8, 2011 + Pyranometer since November 8, 2011 + 2. Filter radiometer data 6-Channels GUV 2511 since November 8, 2011 + 3. Cloud measurements CIR-4V since November 8, 2011 + 4. Meteorological measurements Eole 200 since November 8, 2011 + + + + + Archives: + The SUVIM Observations data are archived at (and are available from) + 1. the Royal Belgian Institute for Space Aeronomy (IASB-BIRA) – http://uvindex.aeronomie.be/ + 2. the European UV Database – http://uv.fmi.fi/uvdb/ + + History of instruments in operation at each station in Belgium and type of data available: + IASB-BIRA – Uccle (BRU) + 1. Spectral data (Global Solar Spectral Irradiance) + Wavelength range : 280 -600 nm + Field of view : 2 pi sr + Period : since March 29, 1993 + 2. Broadband data + UV-B meter (total) since February 2, 1995 + UV-B meter (diffuse) since July 16, 1996 + UV-A meter since May 11, 1995 + pyranometer since July 25, 1995 + 3. Filter radiometradata + 10-Channels SPUV-10 since March 21, 1996 + 7-Channels UVMFR-7 since October 14, 1999 + 7-Channels MFR-7 since December 18, 2003 + 5-Channels GUV-551C since May 23, 1996 + 6-Channels GUV-2511 since June 3, 2005 + 4. Cloud measurements + TSI (Total Sky Imager) since December 7, 1999 + CIR (Cloud Infrared Radiometer) since March 1, 2002 + 5. Meteorological measurements + Eole 100/200 since May 27, 1997 + 6. Sunshine Duration + SDM MS-093 since June 16, 2010 + + Euro Space Center – REDU (RED) + 1. Broadband data UV-B meter since June 15, 2004 + UV-A meter since June 15, 2004 + Pyranometer since June 15, 2004 + 2. Filter radiometer data 5-Channels GUV 511c since March 10, 2005 + 3. Cloud measurements CIR-4 /CIR-4V since December 7, 2006 + 4. Meteorological measurements Eole 200 since March 3, 2005 + 5. Sunshine Duration SDM MS-093 since August 1, 2011 + + Earth Explorer – Ostend (LIT) + 1. Broadband data UV-B meter since April 4, 2006 + UV-A meter since April 4, 2006 + Pyranometer since April 4, 2006 + 2. Filter radiometer data 6-Channels GUV 2511 since June 26, 2006 + 3. Cloud measurements CIR-4/CIR-4V since December 21, 2006 + 4. Meteorological measurements Eole 200 since April 4, 2006 + + Virton – City Hall (GAU) + 1. Broadband data UV-B meter since December 11, 2007 + UV-A meter since December 11, 2007 + Pyranometer since December 11, 2007 + 2. Filter radiometer data 6-Channels GUV 2511 since February 19, 2008 + 3. Cloud measurements CIR-4/CIR-4V since December 11, 2007 + 4. Meteorological measurements Eole 200 since December 11, 2007 + + VITO – Mol (CAM) + 1. Broadband data UV-B meter since December 16, 2008 + UV-A meter since December 16, 2008 + Pyranometer since December 16, 2008 + 2. Filter radiometer data 6-Channels GUV 2511 since February 19, 2008 + 3. Cloud measurements CIR-4/CIR-4V since December 16, 2008 + 4. Meteorological measurements Eole 200 since December 16, 2008 + + Hautes Fagnes Scientific Station - Mont Rigi (FAG) + 1. Broadband data UV-B meter since November 8, 2011 + UV-A meter since November 8, 2011 + Pyranometer since November 8, 2011 + 2. Filter radiometer data 6-Channels GUV 2511 since November 8, 2011 + 3. Cloud measurements CIR-4V since November 8, 2011 + 4. Meteorological measurements Eole 200 since November 8, 2011 + + + + + + + + + + + + + + + + + + + + + eeae2de7-0a09-4b69-b7a0-0b6b20903fd5 + + + + + + + + + discovery + + + + + ZAMG - Zentralanstalt für Meteorologie und Geodynamik + + + + + + + inspire-md@zamg.ac.at + + + + + + + http://www.zamg.ac.at + + + WWW:LINK-1.0-http--link + + + + + + + + + + + + 2020-11-20T00:00:02 + + + ISO19119 + + + 2005/PDAM 1 + + + + + + + CSW Suchdienst der ZAMG + + + + + 2013-10-31 + + + + + + + + + + INSPIRE Suchdienst (discovery service) der Zentralanstalt für Meteorologie und Geodynamik (Nationaler Wetterdienst Österreichs) + + + + + ZAMG - Zentralanstalt für Meteorologie und Geodynamik + + + + + + + inspire-md@zamg.ac.at + + + + + + + + + + + + + + humanCatalogueViewer + + + + + + + Atmosphärische Bedingungen + + + Meteorologisch-geografische Kennwerte + + + + + + + + GEMET - INSPIRE themes, version 1.0 + + + + + 2008-06-01 + + + publication + + + + + + + + + + + INSPIRE Service + + + + + + + + ZAMG - Target Plattform for ZAMG metadata + + + + + 2016-02-11 + + + + + + + + + + geonetwork.thesaurus.external.theme.zamg-mdtarget + + + + + + + + + + + humanCatalogueViewer + + + + + Commission Regulation (EC) No 1205/2008 of 3 December 2008 implementing Directive 2007/2/EC of the European Parliament and of the Council as regards metadata + + + + + 2008-12-03 + + + + + + + + + + + + + + National + + + + + + + + Spatial scope + + + + + 2019-05-22 + + + + + + + + + + + + + + keine Bedingungen anwendbar + + + + + + + license + + + No limitations on public access + + + + + + + + + + No conditions apply to access and use + + + + + discovery + + + 2.0.2 + + + + + + + 9.53357 + + + 17.16639 + + + 46.40749 + + + 49.01875 + + + + + + + + + + + + + + + + + + + + + + + + + application/vnd.ogc.csw_xml + + + 2.0.2 + + + + + + + + + http://catalog.zamg.ac.at/geonetwork/srv/ger/csw-inspire?SERVICE=CSW&VERSION=2.0.2&REQUEST=GetCapabilities&language=ger + + + + + + + + + + + + + + + + + + OGC CSW WebService + + + + + + + + + + + Conformity_001 + + + INSPIRE + + + + + + + + + VERORDNUNG (EG) Nr. 976/2009 DER KOMMISSION vom 19. Oktober 2009 zur Durchführung der Richtlinie 2007/2/EG des Europäischen Parlaments und des Rates hinsichtlich der Netzdienste + + + + + 2009-10-20 + + + + + + + + + + siehe referenzierte Spezifikation + + + true + + + + + + + + + + \ No newline at end of file diff --git a/tests/test_csw_inspire.py b/tests/test_csw_inspire.py new file mode 100644 index 00000000..dcd9326e --- /dev/null +++ b/tests/test_csw_inspire.py @@ -0,0 +1,60 @@ +# flake8: noqa: W503 + +import re +from pathlib import Path +import pytest +from pytest_httpserver import HTTPServer + +from owslib.csw import CatalogueServiceWeb +from owslib.fes import PropertyIsEqualTo + +SERVICE_URL = "https://inspire-geoportal.ec.europa.eu/srv/eng/csw" + +MOCK_SERVER_PORT = 59950 +MOCK_SERVICE_URL = f"http://localhost:{MOCK_SERVER_PORT}/csw" + + +@pytest.fixture +def records(): + """Mock a GetRecords response from INSPIRE Geoportal + + Source: https://inspire-geoportal.ec.europa.eu/srv/eng/csw + """ + inspire_sample = str( + Path(__file__).parent.parent + / "tests" + / "resources" + / "inspire-getrecords-response.xml" + ) + + with open(inspire_sample, "r", encoding="utf-8") as f: + xml_str = f.read() + return xml_str + + +def test_language(records): + """Test records""" + + with HTTPServer(port=MOCK_SERVER_PORT) as httpserver: + httpserver.expect_request(re.compile("^/csw")).respond_with_data(records) + csw = CatalogueServiceWeb(url=MOCK_SERVICE_URL, skip_caps=True) + cq = PropertyIsEqualTo( + "th_httpinspireeceuropaeutheme-theme.link", + "http://inspire.ec.europa.eu/theme/ac", + ) + csw.getrecords2( + constraints=[cq], + outputschema="http://www.isotc211.org/2005/gmd", + maxrecords=2, + startposition=83, + esn="full", + ) + + assert len(csw.records) == 2 + rec1 = csw.records.get("8dad9c98-0512-4845-a2bf-3ace1c93df6f") + assert rec1.languagecode == "eng" + assert rec1.charset == "utf8" + + rec2 = csw.records.get("eeae2de7-0a09-4b69-b7a0-0b6b20903fd5") + assert rec2.languagecode == "ger" + assert rec2.charset is None From 47de71b6afd71663fb6da932f30e2b6ffcff9e7b Mon Sep 17 00:00:00 2001 From: sethg Date: Thu, 6 Mar 2025 22:25:18 +0100 Subject: [PATCH 3/4] Remove live server URL --- tests/test_csw_inspire.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/test_csw_inspire.py b/tests/test_csw_inspire.py index dcd9326e..4e97e98f 100644 --- a/tests/test_csw_inspire.py +++ b/tests/test_csw_inspire.py @@ -8,8 +8,6 @@ from owslib.csw import CatalogueServiceWeb from owslib.fes import PropertyIsEqualTo -SERVICE_URL = "https://inspire-geoportal.ec.europa.eu/srv/eng/csw" - MOCK_SERVER_PORT = 59950 MOCK_SERVICE_URL = f"http://localhost:{MOCK_SERVER_PORT}/csw" From 9808cc0620fa28f11152792e6032f2136eb86c59 Mon Sep 17 00:00:00 2001 From: sethg Date: Thu, 6 Mar 2025 22:39:10 +0100 Subject: [PATCH 4/4] Mark online --- tests/test_csw_inspire.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test_csw_inspire.py b/tests/test_csw_inspire.py index 4e97e98f..35ed6714 100644 --- a/tests/test_csw_inspire.py +++ b/tests/test_csw_inspire.py @@ -30,6 +30,7 @@ def records(): return xml_str +@pytest.mark.online def test_language(records): """Test records"""