Commit 722d0401 authored by Sebastian Ostberg's avatar Sebastian Ostberg
Browse files

add _Encoding attribute to NetCDF files to help with reading character arrays in Python

parent 7de44b3f
......@@ -857,7 +857,15 @@ nc2 <- nc_create(
risk_category_var
)
)
# Set "_Encoding" attribute for character variables to ensure correct reading in
# Python
# First file
ncatt_put(nc, crop_var, "_Encoding", "utf-8")
ncatt_put(nc, irrigation_var, "_Encoding", "utf-8")
# Second file
ncatt_put(nc2, crop_var, "_Encoding", "utf-8")
ncatt_put(nc2, irrigation_var, "_Encoding", "utf-8")
ncatt_put(nc2, risk_category_var, "_Encoding", "utf-8")
# Write name attributes
# First file
ncvar_put(nc, crop_var, dimnames(yield_loss_risk)[[3]])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment