Skip to content
This repository has been archived by the owner on Jun 10, 2023. It is now read-only.

Commit

Permalink
issue #23 - rivm aps2raster no rounding, use float for GeoTIFF cells
Browse files Browse the repository at this point in the history
  • Loading branch information
justb4 committed Oct 9, 2015
1 parent 00db4e3 commit 7f6de26
Show file tree
Hide file tree
Showing 15 changed files with 27,248 additions and 14 deletions.
10 changes: 10 additions & 0 deletions data/eionet/aq-report/nl/REP_D-NL_RIVM_20140805_B-002.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
GMLID,LocalId,Namespace,GeographicalName,ZoneCode,ZoneType,BeginTime,EndTime,EnvironmentalDomain,AQDZoneType,ResidentPopulation,Area,TimeExtensionExemption,ResidentPopulationYear,SRSName
ZON-NL0210,ZON-NL0210,NL.RIVM.AQ,Amsterdam/Haarlem,NL0210,http://dd.eionet.europa.eu/vocabulary/aq/zonetype/agg,2001-01-01T00:00:00+01:00,,http://dd.eionet.europa.eu/vocabulary/common/environmentaldomain/air,,1604719,891,http://dd.eionet.europa.eu/vocabulary/aq/timeextensiontypes/NO2-annual ,,
ZON-NL0231,ZON-NL0231,NL.RIVM.AQ,Den Haag/ Leiden vanaf 2013,NL0231,http://dd.eionet.europa.eu/vocabulary/aq/zonetype/agg,2013-01-01T00:00:00+01:00,,http://dd.eionet.europa.eu/vocabulary/common/environmentaldomain/air,,1121120,461,http://dd.eionet.europa.eu/vocabulary/aq/timeextensiontypes/NO2-annual ,2013,
ZON-NL0310,ZON-NL0310,NL.RIVM.AQ,Eindhoven,NL0310,http://dd.eionet.europa.eu/vocabulary/aq/zonetype/agg,2001-01-01T00:00:00+01:00,,http://dd.eionet.europa.eu/vocabulary/common/environmentaldomain/air,,435913,276,http://dd.eionet.europa.eu/vocabulary/aq/timeextensiontypes/NO2-annual ,,
ZON-NL0320,ZON-NL0320,NL.RIVM.AQ,Heerlen/ Kerkrade,NL0320,http://dd.eionet.europa.eu/vocabulary/aq/zonetype/agg,2001-01-01T00:00:00+01:00,,http://dd.eionet.europa.eu/vocabulary/common/environmentaldomain/air,,231574,174,http://dd.eionet.europa.eu/vocabulary/aq/timeextensiontypes/NO2-annual ,,
ZON-NL0201,ZON-NL0201,NL.RIVM.AQ,Midden vanaf 2013,NL0201,http://dd.eionet.europa.eu/vocabulary/aq/zonetype/noagg,2013-01-01T00:00:00+01:00,,http://dd.eionet.europa.eu/vocabulary/common/environmentaldomain/air,,4999395,11881,http://dd.eionet.europa.eu/vocabulary/aq/timeextensiontypes/NO2-annual ,2013,
ZON-NL0100,ZON-NL0100,NL.RIVM.AQ,Noord,NL0100,http://dd.eionet.europa.eu/vocabulary/aq/zonetype/noagg,2001-01-01T00:00:00+01:00,,http://dd.eionet.europa.eu/vocabulary/common/environmentaldomain/air,,3235377,17222,http://dd.eionet.europa.eu/vocabulary/aq/timeextensiontypes/NO2-annual ,,
ZON-NL0241,ZON-NL0241,NL.RIVM.AQ,Rotterdam/ Dordrecht vanaf 2013,NL0241,http://dd.eionet.europa.eu/vocabulary/aq/zonetype/agg,2013-01-01T00:00:00+01:00,,http://dd.eionet.europa.eu/vocabulary/common/environmentaldomain/air,,1298830,658,http://dd.eionet.europa.eu/vocabulary/aq/timeextensiontypes/NO2-annual ,2013,
ZON-NL0221,ZON-NL0221,NL.RIVM.AQ,Utrecht vanaf 2013,NL0221,http://dd.eionet.europa.eu/vocabulary/aq/zonetype/agg,2013-01-01T00:00:00+01:00,,http://dd.eionet.europa.eu/vocabulary/common/environmentaldomain/air,,459575,205,http://dd.eionet.europa.eu/vocabulary/aq/timeextensiontypes/NO2-annual ,2013,
ZON-NL0300,ZON-NL0300,NL.RIVM.AQ,Zuid,NL0300,http://dd.eionet.europa.eu/vocabulary/aq/zonetype/noagg,2001-01-01T00:00:00+01:00,,http://dd.eionet.europa.eu/vocabulary/common/environmentaldomain/air,,3278844,9775,http://dd.eionet.europa.eu/vocabulary/aq/timeextensiontypes/NO2-annual ,,
138 changes: 138 additions & 0 deletions data/eionet/aq-report/nl/REP_D-NL_RIVM_20140805_C-001.csv

Large diffs are not rendered by default.

671 changes: 671 additions & 0 deletions data/eionet/aq-report/nl/REP_D-NL_RIVM_20140805_D-002.csv

Large diffs are not rendered by default.

48 changes: 48 additions & 0 deletions data/eionet/aq-report/nl/zones-wfs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@

{"properties": {
"objectid": 9,
"geometry_l": 81872.10739,
"geometry_a": 1.74366211597E8,
"zone_code": "NL0320",
"zone_name": "Heerlen/Kerkrade",
"zone_name_": "Agglomeratie Heerlen/Kerkrade",
"start_year": 2011,
"end_year": null,
"zone_type": "agg",
"zone_popul": 231870,
"zone_pop_1": 2013,
"zone_area_": 174366,
"zone_area1": 174,
"zone_prede": null
}}

{"properties": {
"inspireid": "http://data.rivm.nl/inspire/so/ef/aqd-zone/NL0320/0",
"zone_code": "NL0320",
"versionid": 0,
"predecessor": null,
"beginlifespanversion": "2013-05-06T11:03:35.926Z",
"endlifespanversion": null,
"zone_name": "Heerlen/Kerkrade",
"zone_type": "airQualityManagementZone",
"application_start_date": "2001-06-20T22:00:00Z",
"application_end_date": null,
"documentation_of_predecessors": null,
"resident_population": null,
"resident_population_ref_year": null,
"area_of_zone_value": null,
"area_of_zone_uom": "sqm",
"designated_pollutant": null,
"protection_target": "Health",
"timeextensionexemption": "NO2-annual",
"environmental_domain": "air",
"plan": null,
"legalbasis": "Directive 2008/50/EC of the European Parliament and of the Council of 21 May 2008 on ambient air quality and cleaner air for Europe",
"relatedzone": null,
"authority_name": "Ministerie van I&M",
"webaddress": "http://www.rijksoverheid.nl/ministeries/ienm",
"responsible_person_name": "Inge van der Veen",
"address": "Plesmanweg 1-6 2597JG Den Haag",
"telephone_number": "+31704560000",
"email": null
}}
26,367 changes: 26,367 additions & 0 deletions data/rivm-lml/zones/DE_B_Zones_2013.xml

Large diffs are not rendered by default.

Binary file modified data/rivm-rio/aps2raster/2015091611_no2.tif
Binary file not shown.
Binary file modified data/rivm-rio/aps2raster/2015091611_o3.tif
Binary file not shown.
Binary file modified data/rivm-rio/aps2raster/2015091611_pm10.tif
Binary file not shown.
Binary file modified docs/_static/rivm-rio/aps_no2_compared.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_static/rivm-rio/aps_o3_compared.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_static/rivm-rio/aps_pm10_compared.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 7 additions & 7 deletions src/rivm-rio/aps2raster.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ def array2raster(out_file, origin, pixel_width, pixel_height, array, meta, epsg_
driver = gdal.GetDriverByName('GTiff')

# Create raster with 1-band and 1-byte cells
out_raster = driver.Create(out_file, cols, rows, n_bands, gdal.GDT_Int16)
out_raster = driver.Create(out_file, cols, rows, n_bands, gdal.GDT_Float32)

# affine transformation coefficients
out_raster.SetGeoTransform((origin_x, pixel_width, 0, origin_y, 0, pixel_height))

# Write array data to first rasterband
out_band = out_raster.GetRasterBand(1)
out_band.SetUnitType('ug/m3')
out_band.SetNoDataValue(-999)
out_band.SetNoDataValue(-999.0)

metadata = {
'name': 'concentration'
Expand Down Expand Up @@ -145,15 +145,15 @@ def read_aps_file(file_path):
pixel_height = -aps_meta['pixel_height']

# http://docs.scipy.org/doc/numpy/reference/generated/numpy.around.html
# Round all floats first
aps_array = np.around(aps_array)
# Round all floats first ==> no more, as gives wrong results in legenda
# aps_array = np.around(aps_array)

# http://stackoverflow.com/questions/7994133/fast-in-place-replacement-of-some-values-in-a-numpy-array
# Make negative values zero NB maybe need NO_VALUE
# Make negative values zero ==> no more, use GDAL's NO DATA value
# aps_array[aps_array < 0] = 0

# COnvert rounded floats to ints
aps_array = aps_array.astype(int)
# Convert rounded floats to ints ==> no more, as gives wrong results in legenda
# aps_array = aps_array.astype(int)

# Debug: convert to oridinary Python list (array)
# aps_list = aps_array.tolist()
Expand Down
4 changes: 2 additions & 2 deletions src/rivm-rio/sld/aps_03.sld
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
<ColorMapEntry color="#6699CC" quantity="60" label="&lt; 60 ug/m3" opacity="1.0"/>
<ColorMapEntry color="#99CCCC" quantity="120" label="60-120 ug/m3" opacity="1.0"/>
<ColorMapEntry color="#CCFFFF" quantity="180" label="120-180 ug/m3" opacity="1.0"/>
<ColorMapEntry color="#FFFFCC" quantity="200" label="180-200 ug/m3" opacity="1.0"/> <!-- Yellow -->
<ColorMapEntry color="#FFFFCC" quantity="200" label="180-200 ug/m3" opacity="1.0"/> <!-- Yellow -->
<ColorMapEntry color="#FFCC66" quantity="220" label="200-220 ug/m3" opacity="1.0"/>
<ColorMapEntry color="#FF9966" quantity="240" label="220-240 ug/m3" opacity="1.0"/>
<ColorMapEntry color="#990033" quantity="20000" label="&gt; 240 ug/m3" opacity="1.0"/>
</ColorMap>
</ColorMap>
</RasterSymbolizer>
</Rule>
</FeatureTypeStyle>
Expand Down
6 changes: 3 additions & 3 deletions src/rivm-rio/sld/aps_no2.sld
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<StyledLayerDescriptor version="1.0.0" xmlns="http://www.opengis.net/sld" xmlns:ogc="http://www.opengis.net/ogc"
xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<StyledLayerDescriptor version="1.0.0" xmlns="http://www.opengis.net/sld"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd">
<NamedLayer>
<Name>rivm_aps_no2</Name>
Expand All @@ -17,7 +17,7 @@
<ColorMapEntry color="#6699CC" quantity="20" label="&lt; 20 ug/m3" opacity="1.0"/>
<ColorMapEntry color="#99CCCC" quantity="50" label="20-50 ug/m3" opacity="1.0"/>
<ColorMapEntry color="#CCFFFF" quantity="200" label="50-200 ug/m3" opacity="1.0"/>
<ColorMapEntry color="#FFFFCC" quantity="250" label="200-250 ug/m3" opacity="1.0"/> <!-- Yellow -->
<ColorMapEntry color="#FFFFCC" quantity="250" label="200-250 ug/m3" opacity="1.0"/> <!-- Yellow -->
<ColorMapEntry color="#FFCC66" quantity="350" label="250-350 ug/m3" opacity="1.0"/>
<ColorMapEntry color="#FF9966" quantity="400" label="350-400 ug/m3" opacity="1.0"/>
<ColorMapEntry color="#990033" quantity="20000" label="&gt; 400 ug/m3" opacity="1.0"/>
Expand Down
4 changes: 2 additions & 2 deletions src/rivm-rio/sld/aps_pm10.sld
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
<ColorMapEntry color="#6699CC" quantity="10" label="&lt; 10 ug/m3" opacity="1.0"/>
<ColorMapEntry color="#99CCCC" quantity="30" label="10-30 ug/m3" opacity="1.0"/>
<ColorMapEntry color="#CCFFFF" quantity="50" label="30-50 ug/m3" opacity="1.0"/>
<ColorMapEntry color="#FFFFCC" quantity="75" label="50-75 ug/m3" opacity="1.0"/> <!-- Yellow -->
<ColorMapEntry color="#FFFFCC" quantity="75" label="50-75 ug/m3" opacity="1.0"/> <!-- Yellow -->
<ColorMapEntry color="#FFCC66" quantity="125" label="75-125 ug/m3" opacity="1.0"/>
<ColorMapEntry color="#FF9966" quantity="200" label="125-200 ug/m3" opacity="1.0"/>
<ColorMapEntry color="#990033" quantity="20000" label="&gt; 200 ug/m3" opacity="1.0"/>
</ColorMap>
</ColorMap>
</RasterSymbolizer>
</Rule>
</FeatureTypeStyle>
Expand Down

0 comments on commit 7f6de26

Please sign in to comment.