Skip to content

Commit

Permalink
Added nhi_chloride_concentration v1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
bdestombe committed Mar 11, 2024
1 parent b10f57a commit 2722ea5
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 2 deletions.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import os
import nlmod
import xarray as xr

nhflo_data_dir = "/Users/bdestombe/Downloads"
fp_cl = os.path.join(nhflo_data_dir, "3dchloride_result.nc")
assert os.path.isfile(fp_cl), f"file {fp_cl} not found"
cl = xr.open_dataset(fp_cl)

for p in cl.percentile.values:
conc = cl["3d-chloride"].sel(percentile=p).rename("chloride_{p}")
vmin, vmax = conc.min().item(), conc.max().item()
encoding = {
"zlib": True,
"complevel": 5,
"fletcher32": True, # Store checksums to detect corruption
}
dval_max = 5.
assert nlmod.dims.attributes_encodings.is_int16_allowed(vmin, vmax, dval_max), "Store as float instead"
scale_factor, add_offset = nlmod.dims.attributes_encodings.compute_scale_and_offset(vmin, vmax)
encoding["dtype"] = "int16"
encoding["scale_factor"] = scale_factor
encoding["add_offset"] = add_offset
encoding["_FillValue"] = -32767 # default for NC_SHORT

fp_out = os.path.join(nhflo_data_dir, f"chloride_{p}.nc")
conc.to_netcdf(fp_out, encoding={"chloride_{p}": encoding})

21 changes: 19 additions & 2 deletions src/nhflodata/data/repository.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ data:
description_long: Bodemlagen van PWN rondom pompstation Bergen
contact: bas.des.tombe@pwn.nl
timezone: Europe/Amsterdam
extent: [-7000, 289000, 300000, 629000]
extent: [-7000, 289000, 300000, 629000] # minx, miny, maxx, maxy
paths:
local: bodemlagen_pwn_bergen/v1.0.0
nhflo_server: /data/bodemlagen_pwn_bergen/v1.0.0
Expand Down Expand Up @@ -86,4 +86,21 @@ data:
mockup: mockup/oppervlaktewater_pwn_shapes_panden/v1.0.0
changelog:
previous_version: "0.0.0"
log: ""
log: ""
nhi_chloride_concentration:
- version_nhflo: "1.0.0" # Semantic version of the data in NHFLO
owner: NHI, Deltares, Arcadis.
publication_date: "2020-06-16"
version_owner: "1.0.0"
description_short: NHI chloride concentration. Actualisatie zout in het NHI, Delsman et.al., 2020.
description_long: Selection made available with reduced precision. Delsman, Joost & Oude Essink, Gualbert & Huizer, S. & Bootsma, Huite & Mulder, Tobias & Zitman, Pieter & Romero Verastegui, Betsy & Janssen, Gijs. (2020). Actualisatie zout in het NHI; Toolbox NHI zoet-zout modellering en landelijk model. 10.13140/RG.2.2.17077.09447.
contact: bas.des.tombe@pwn.nl
timezone: Europe/Amsterdam
extent: [0, 300000, 300000, 625000] # minx, miny, maxx, maxy
paths:
local: nhi_chloride_concentration/v1.0.0
nhflo_server: /data/nhi_chloride_concentration/v1.0.0
mockup: mockup/nhi_chloride_concentration/v1.0.0
changelog:
previous_version: "0.0.0"
log: "Only p50 made available. p25 and p75 are omitted for now. Precision reduced using the acompanying Python file to reduce the file size from gigabytes to 30-40 megabytes."

0 comments on commit 2722ea5

Please sign in to comment.