DHI-GRAS / senEtSnapSta

:gear: SNAP STA for Sen-ET
GNU General Public License v3.0
11 stars 2 forks source link

Error message when I'm trying to work with local meteorological data #19

Closed Ioannis-Faraslis closed 4 years ago

Ioannis-Faraslis commented 4 years ago

I want to work with local meteorological data. I have created the *nc file with the same variables as ERA5 reanalysis but when I proceed to the next step "Prepare ERA5 reanalysis surface meteorological data I get an error message "unsupported operand type for: "float" and "NoneType". Please see the the attached image. Any help would be greatly appreciated. Thanks! error_WRF

radosuav commented 4 years ago

The netCDF file you created must have a time dimension (and in general the same structure as the netCDF file download from ECMWF) and it looks like it does not. To check the file structure open it in SNAP and look in the Metadata tree: image

Ioannis-Faraslis commented 4 years ago

Thanks for the quick reply. I believe there is the the time dimension. Please see the attached file. Thanks time_WRF

j08lue commented 4 years ago

The float * None error you are seeing could be coming from this line: https://github.com/DHI-GRAS/sen-et-snap-scripts/blob/master/ecmwf_utils.py#L189

I.e. the file you created has no scale factor on the data, but we expect that. We can add this to a list of things to fix when we touch the code next time, but you could circumvent this quickly by making sure your netCDF data variable encoding matches the one of the original ECMWF files. If you use Xarray, you can add a scale factor as follows:

import xarray as xr

with xr.open_dataset("your-file.nc") as ds:
    encoding = {}
    for varn, da in ds.data_vars.items():
        encoding[varn] = da.encoding.copy()
        encoding[varn].update(scale_factor=1)
    ds.to_netcdf("your-file-fixed.nc", encoding=encoding)
Ioannis-Faraslis commented 4 years ago

I have added, scale_factor, add_offset, missing_value και _FillValue in the attributes and now I get and other error message "None Type..... GetRaster band". Please see the attached file. Thanks! getrasterband_WRF

j08lue commented 4 years ago

Yes, the real error is reported in the line starting with ERROR: something with the image transform. The None error is just a failure downstream.

Seems like there are more differences between your data and ECMWF. You see, we did not test this to work with other formats than the original, like your WRF data. Would be great if it did, but tracing all those cases you are now facing would require quite a lot of work.

radosuav commented 4 years ago

It might be some deeper problem because very similar error is reported in #18 with ECMWF meteo file. I will try to investigate next week.

Ioannis-Faraslis commented 4 years ago

Dear Sen4et experts, thanks for your reply. I'll be looking forward your results next week in order to proceed with WRF weather data analysis. They have 2X2 km spatial resolution and I believe this will improve the actual ET product.

radosuav commented 4 years ago

Hi, actually it looks like the two issues are unrelated. Yours seems to be due to GDAL on Windows not handling unicode characters well. Maybe try running on Linux to see if this issues remains.

Ioannis-Faraslis commented 4 years ago

Thanks for the reply. For the moment I'm working on win10 environment and it's difficult to change to Linux.