niclasmattsson / GlobalEnergyGIS

Generates input data for energy models on renewable energy in arbitrary world regions using public datasets. Written in Julia 1.x.
MIT License
64 stars 24 forks source link

d_create error #10

Open jdemaigret opened 3 years ago

jdemaigret commented 3 years ago

When running makewindera5(year=2018) (step 6 in the readme), the following error message pops up:

ERROR: UndefVarError: d_create not defined

It seems that the function d_create has been replaced with create_dataset even the latest downloadable versions of the HDF5.jl file.

I'm currently using JuliaPro 1.5.4-1 IDE, with HDF5.jl file version v0.15.4 on Windows 10.

FabsOliveira commented 3 years ago

Simply replacing d_create with create_dataset and adequating the syntax (just like in #9) did not work either. Got this error now:

ERROR: GDALError (CE_Failure, code 10):
        Pointer 'hDS' is NULL in 'GDALGetGeoTransform'.

Stacktrace:
  [1] gdaljl_errorhandler(class::GDAL.CPLErr, errno::Int32, errmsg::Cstring)
    @ GDAL ~/.julia/packages/GDAL/SEaao/src/error.jl:36
  [2] gdalgetgeotransform
    @ ~/.julia/packages/GDAL/SEaao/src/gdal_h.jl:1109 [inlined]
  [3] getgeotransform!(dataset::ArchGDAL.Dataset, transform::Vector{Float64})
    @ ArchGDAL ~/.julia/packages/ArchGDAL/CUiBS/src/dataset.jl:641
  [4] getgeotransform
    @ ~/.julia/packages/ArchGDAL/CUiBS/src/dataset.jl:646 [inlined]
  [5] (::GlobalEnergyGIS.var"#10#11"{Int64})(dataset::ArchGDAL.Dataset)
    @ GlobalEnergyGIS ~/Documents/GitHub/GlobalEnergyGIS/src/rasterize_shapefiles.jl:53
  [6] read(f::GlobalEnergyGIS.var"#10#11"{Int64}, args::String; kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ ArchGDAL ~/.julia/packages/ArchGDAL/CUiBS/src/context.jl:216
  [7] read
    @ ~/.julia/packages/ArchGDAL/CUiBS/src/context.jl:214 [inlined]
  [8] readraster(infile::String, extentflag::Symbol, dim::Int64)
    @ GlobalEnergyGIS ~/Documents/GitHub/GlobalEnergyGIS/src/rasterize_shapefiles.jl:51
  [9] readraster (repeats 2 times)
    @ ~/Documents/GitHub/GlobalEnergyGIS/src/rasterize_shapefiles.jl:71 [inlined]
 [10] getwindatlas()
    @ GlobalEnergyGIS ~/Documents/GitHub/GlobalEnergyGIS/src/make_auxiliary_datasets.jl:353
 [11] makewindera5(; year::Int64, windatlas_only::Bool)
    @ GlobalEnergyGIS ~/Documents/GitHub/GlobalEnergyGIS/src/makewindera5.jl:14
 [12] top-level scope

Seems something with the way the command ArchGDAL. Maybe some syntax change there too? Can't figure that one out 😞

niclasmattsson commented 3 years ago

Thank you for reporting. You're correct, apparently HDF.jl changed its API. The d_create error has now been fixed on latest master. Please update and try again.

@FabsOliveira, that GDALerror is probably a "file not found" error in disguise. My guess is that it's related to a recent update of the WDPA database (i.e. protected areas), which changed the internal naming of the shapefiles. I fixed this a few weeks ago, although you may have to download and rasterize the latest version of the database:

download_datasets("WDPA")
rasterize_protected()

If this doesn't help, please open a separate issue with the command that produces the error.