Datasets:
Errorrs in assemble_data.py
Hello!
When using assemble_data.py as python assemble_data.py --input_dir . --output_file Wave-Layer.nc
, there is an error in line 58 where for nc_file in c_files[]
should be for nc_file in c_files
; otherwise, it will raise an error before actually running the code.
However, even with the fixed code, there is an error when assembling data:
python assemble_data.py --input_dir . --output_file Wave-Layer.nc
Processing ./solution_0.nc
Processing ./solution_1.nc
Processing ./solution_2.nc
Processing ./c_0.nc
Traceback (most recent call last):
File "/home/liu/WorkSpace/projects/FfF/Posiedon/poseidon_ft/dataset/Wave-Layer/assemble_data.py", line 79, in <module>
assemble_data(args.input_dir, args.output_file)
File "/home/liu/WorkSpace/projects/FfF/Posiedon/poseidon_ft/dataset/Wave-Layer/assemble_data.py", line 68, in assemble_data
out_nc[c_file.split("_")[0]][samples[i] : samples[i + 1]] = variable[:]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "src/netCDF4/_netCDF4.pyx", line 5490, in netCDF4._netCDF4.Variable.__setitem__
File "src/netCDF4/_netCDF4.pyx", line 4560, in netCDF4._netCDF4.Variable.shape.__get__
File "src/netCDF4/_netCDF4.pyx", line 4512, in netCDF4._netCDF4.Variable._getdims
File "src/netCDF4/_netCDF4.pyx", line 2142, in netCDF4._netCDF4._inq_vardimid
File "src/netCDF4/_netCDF4.pyx", line 2134, in netCDF4._netCDF4._inq_varndims
File "src/netCDF4/_netCDF4.pyx", line 2113, in netCDF4._netCDF4._ensure_nc_success
RuntimeError: NetCDF: Variable not found
With the error shown, the script seems to still be generating the final data file Wave-Layer.nc
.
Python version: 3.11
netCDF4 version: 1.7.1.post1
I appreciate your help in advance!
Cheers,
Qiang
Hi Qiang --
Thanks for reporting the problem!
I think, I fixed it. Could you try again with the updated script?
Best,
Max
Hi Max,
Thanks for the swift reply! Yes, now it works smoothly!
Cheers,
Qiang
Perfect!
To be completely sure, you could maybe plot the first two samples in the assembled dataset to check if everything worked.
They look very similar, if not equal... Is this the initial condition? What about the wave speed?
Hi, Max,
These are the first two frames of the first trajectory; I just checked the animation of the whole trajectory, and it is correct!
Thanks for your great work and swift reply, I will let you know if I find anything wrong with the code/dataset.
Cheers,
Qiang