I have a NetCDF file that is created using Matlab and it is composed of 'double" values of 1 and 0. I can read the values as they are without any issues inside Matlab.
However, when I tried to read it using Julia, their values all changed to 9.969209968386869e36.
Here is my code to read the nc file:
Using NCDatasets
# get the land mask (NetCDF file)
Path_mask = "xxx";
FN_mask = "test.nc";
File_mask = joinpath(Path_mask, FN_mask);
data =
Dataset(File_mask,"r") do ds0
ds0["Land"][:,:]
end # ds is closed
Apparently 9.969209968386869e36 has been used in various places as a default “fill value” for when the application hasn’t written data. (Perhaps originating with NCL Language Reference Guide: Variables ?) So this would explain where the value is coming from, but not why reading the file gives different results from Matlab.
You could start debugging by inspecting the structure of the file using
Matlab’s ncdisp and comparing to show(io, ::NCDatasets.Dataset).
If you want more specific help it would be best to post a self-contained example (maybe including the example NetCDF somewhere which can be downloaded) so people can run on their own computers and reproduce the problem.