Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NetCDF data/time dimension handling broken #1

Closed
ludwigus opened this issue Mar 21, 2022 · 1 comment
Closed

NetCDF data/time dimension handling broken #1

ludwigus opened this issue Mar 21, 2022 · 1 comment

Comments

@ludwigus
Copy link

Hi,
great that you took over and modified TimeManager to make it work with newer QGIS-Versions. However, it seems that one of the modifications broke the date/time handling for NetCDF time dimensions.
I have attached an example NetCDF here:
CMEMS_BAL_PHY_reanalysis_surface_19940303.nc.zip
There the time variable is defined as follows (ncdump -h):
double time(time) ; time:units = "days since 1950-01-01 00:00:00" ; time:long_name = "Validity time" ; time:standard_name = "time" ; time:calendar = "gregorian" ; time:axis = "T" ;
and it contains a time step for each hour of this day:
time = 16132, 16132.0416666665, 16132.0833333335, 16132.125, 16132.1666666665, 16132.2083333335, 16132.25, 16132.2916666665, 16132.3333333335, 16132.375, 16132.4166666665, 16132.4583333335, 16132.5, 16132.5416666665, 16132.5833333335, 16132.625, 16132.6666666665, 16132.7083333335, 16132.75, 16132.7916666665, 16132.8333333335, 16132.875, 16132.9166666665, 16132.9583333335 ;
It is loaded correctly in QGIS as raster layer with bands for each time step.

However, loading this layer in TimeManager (with "Layer is netCDF file with time dimension" checked) yields An error occurred while trying to add layer sla to TimeManager. Cause: NetCDF: Attribute not found.

For another file with time defined as float time(time) ; time:long_name = "time" ; time:calendar = "standard" ; time:units = "days since 1858-11-17 00:00:00.0" ; time:actual_range = 48895., 59635. ; there is no error but the time range displayed by TimeManager is 1970-01-01 13:34:55 -- 1970-01-01 16:33:55 (should be 1992-09-30 00:00:00-- 2022-02-25 00:00:00). This looks like the unit is not interpreted correctly.

If I load both files with the old version of TimeManager (I only modified qgisMaximumVersion in metadata.txt) it works correctly, so the bug must be caused by your modifications.

@javadadabi
Copy link
Owner

javadadabi commented Nov 14, 2023

Dear @ludwigus accept my apology for late answering.
Thank you for reporting this issue and your pull request.
Your solution was checked, it can solve some part of the issue,
So I tried to fix this issue in version 3.7 using netCDF4 time unit(Unit) variable at first try, then try your solution in exception.
You can try timemanager capabilities using: http://download.csr.utexas.edu/outgoing/grace/RL0602_mascons/CSR_GRACE_GRACE-FO_RL0602_Mascons_all-corrections.nc
The plugin package for version 3.7 has been uploaded and is awaiting for approval.
Best regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants