gher-uliege / DIVAnd.jl

DIVAnd performs an n-dimensional variational analysis of arbitrarily located observations
GNU General Public License v2.0
72 stars 11 forks source link

ArgumentError: unable to parse ... as Dates.DateTime #80

Closed ctroupin closed 3 years ago

ctroupin commented 3 years ago

Description: trying to read an ODV spreadsheet file (time series).
Data file available at https://dox.ulg.ac.be/index.php/s/S2W0mcXcfOf9zJZ

using DIVAnd
ENV["JULIA_DEBUG"] = "all"

varname = "Water body dissolved inorganic nitrogen (DIN)"
filename = "PO_data_from_Eutrophication_MED_time_series_2.2021.txt"
obsval, obslon, obslat, obsdepth, obstime, obsids = DIVAnd.ODVspreadsheet.load(Float64,[filename],
                           [varname] ;  nametype =:localname ) ;

Problem:

ArgumentError: unable to parse National Institute of Biology - Marine Biology Station (1229) as Dates.DateTime

Stacktrace:
 [1] myparse(T::Type, s::SubString{String})
   @ DIVAnd.ODVspreadsheet ~/.julia/packages/DIVAnd/0X6Ph/src/ODVspreadsheet.jl:412
 [2] SDNparse!(col::Vector{SubString{String}}, fillmode::Symbol, fillvalue::Dates.DateTime, data::Vector{Dates.DateTime})
   @ DIVAnd.ODVspreadsheet ~/.julia/packages/DIVAnd/0X6Ph/src/ODVspreadsheet.jl:445
 [3] loaddataqv(sheet::DIVAnd.ODVspreadsheet.Spreadsheet, profile::Matrix{SubString{String}}, locname::String, fillvalue::Dates.DateTime; fillmode::Symbol, qvlocalname::String)
   @ DIVAnd.ODVspreadsheet ~/.julia/packages/DIVAnd/0X6Ph/src/ODVspreadsheet.jl:511
 [4] loadprofile(T::Type{Float64}, sheet::DIVAnd.ODVspreadsheet.Spreadsheet, iprofile::Int64, dataname::String; nametype::Symbol, qvlocalname::String)
   @ DIVAnd.ODVspreadsheet ~/.julia/packages/DIVAnd/0X6Ph/src/ODVspreadsheet.jl:624
 [5] load(T::Type, fnames::Vector{String}, datanames::Vector{String}; qv_flags::Vector{String}, nametype::Symbol, qvlocalname::String)
   @ DIVAnd.ODVspreadsheet ~/.julia/packages/DIVAnd/0X6Ph/src/ODVspreadsheet.jl:770
 [6] top-level scope
   @ In[3]:1
 [7] eval
   @ ./boot.jl:360 [inlined]
 [8] include_string(mapexpr::typeof(REPL.softscope), mod::Module, code::String, filename::String)
   @ Base ./loading.jl:1090

Solution: I converted the spreadsheet to netCDF and it worked, but did not have time to solve the issue with the spreadsheet.

Alexander-Barth commented 3 years ago

Can you import the file back in ODV?

ctroupin commented 3 years ago

yes I can try that.

ctroupin commented 3 years ago

So the issue was due to a tab in one of the field if I understood well the discussions, meaning we can close. Colleagues will contact the data originator to correct it and avoid the issue in the future.