diff --git a/src/NCODV.jl b/src/NCODV.jl index 7f2efb0..6d0c82d 100644 --- a/src/NCODV.jl +++ b/src/NCODV.jl @@ -334,7 +334,7 @@ function load(T, fname, long_name; qv_flags = ["good_value", "probably_good_valu ncvar_LOCAL_CDI_ID = varbyattrib_first(ds, long_name = "LOCAL_CDI_ID") if ndims(ncvar_LOCAL_CDI_ID) == 2 - LOCAL_CDI_ID = chararray2strings(ncvar_LOCAL_CDI_ID.var[:]) + LOCAL_CDI_ID = chararray2strings(Array(ncvar_LOCAL_CDI_ID.var)) else @warn """The variable with the long_name attribute \'LOCAL_CDI_ID\' is expected to have two dimensions. For example the output of 'ncdump -h' of $fname should contain: [...] @@ -348,13 +348,13 @@ We use the empty string for LOCAL_CDI_ID instead. end EDMO_CODE = if length(varbyattrib(ds; long_name = "EDMO_code")) > 0 - varbyattrib_first(ds, long_name = "EDMO_code")[:] + Array(varbyattrib_first(ds, long_name = "EDMO_code")) else - varbyattrib_first(ds, long_name = "EDMO_CODE")[:] + Array(varbyattrib_first(ds, long_name = "EDMO_CODE")) end - obsproflon = varbyattrib_first(ds, standard_name = "longitude")[:] - obsproflat = varbyattrib_first(ds, standard_name = "latitude")[:] + obsproflon = Array(varbyattrib_first(ds, standard_name = "longitude")) + obsproflat = Array(varbyattrib_first(ds, standard_name = "latitude")) # time for time series ncvar_time = nothing @@ -369,7 +369,7 @@ We use the empty string for LOCAL_CDI_ID instead. @assert ndims(ncvar_time) == 2 else # profile - obsproftime = varbyattrib_first(ds, standard_name = "time")[:] + obsproftime = Array(varbyattrib_first(ds, standard_name = "time")) @assert ndims(obsproftime) == 1 end diff --git a/src/NCSDN.jl b/src/NCSDN.jl index 0748597..5610119 100644 --- a/src/NCSDN.jl +++ b/src/NCSDN.jl @@ -61,11 +61,11 @@ function loadvar( return T[] end - dataarray = ds[param][:] + dataarray = Array(ds[param]) data = nomissing(dataarray, fillvalue) if qfname in ds - qf = ds[qfname].var[:] + qf = Array(ds[qfname].var) keep_data = falses(size(qf)) @@ -176,7 +176,7 @@ function load( ) if ndims(lon) == 1 - #@show fname,param,size(lon),size(data) + @debug "check size",fname,param,size(lon),size(data) @assert size(lon, 1) == size(data, 2) lon = repeat(reshape(lon, 1, size(lon, 1)), inner = (size(data, 1), 1)) end @@ -207,8 +207,8 @@ function load( time = repeat(reshape(time, 1, size(time, 1)), inner = (size(data, 1), 1)) end - edmo = ds["SDN_EDMO_CODE"][:] - cdiid = ds["SDN_LOCAL_CDI_ID"][:] + edmo = Array(ds["SDN_EDMO_CODE"]) + cdiid = Array(ds["SDN_LOCAL_CDI_ID"]) @assert size(edmo, 1) == size(data, 2) @assert size(cdiid, 2) == size(data, 2) diff --git a/test/test_ncodv.jl b/test/test_ncodv.jl index 66a0207..44e6cc6 100644 --- a/test/test_ncodv.jl +++ b/test/test_ncodv.jl @@ -375,14 +375,14 @@ obsvalue,obslon,obslat,obsdepth,obstime,obsids = NCODV.load(T,fname_TS,long_name almostgood(qf) = !ismissing(qf) && ((qf == 49) || (qf == 50)) nc = NCDataset(fname_TS) -ox = nc["var3"][:]; -ox_qf = nc["var3_qc"][:]; +ox = nc["var3"][:,:]; +ox_qf = nc["var3_qc"][:,:]; -z = nc["var2"][:]; -z_qf = nc["var2_qc"][:]; +z = nc["var2"][:,:]; +z_qf = nc["var2_qc"][:,:]; -time = nc["var1_qc"].var[:]; -time_qf = nc["var1_qc"][:]; +time = nc["var1_qc"].var[:,:]; +time_qf = nc["var1_qc"][:,:]; good = almostgood.(ox_qf) .& .!ismissing.(ox) .& almostgood.(z_qf) .& .!ismissing.(z) .& almostgood.(time_qf) .& .!ismissing.(time) diff --git a/test/test_save.jl b/test/test_save.jl index deb3c63..b633f06 100644 --- a/test/test_save.jl +++ b/test/test_save.jl @@ -21,7 +21,7 @@ relerr = rand(T, sz) DIVAnd.save(filename, xyi, fi, varname; type_save = T, relerr = relerr) ds = Dataset(filename) -fi2 = ds[varname][:] +fi2 = ds[varname][:,:,:,:] close(ds) @test fi2[mask] == fi[mask]