cardat / air-health-bushfire-smoke-netcdf

Software to share australian bushfire smoke data funded by CAR and ARDC. Supported by CurtinIC and ASDAF
MIT License
1 stars 0 forks source link

Date assumption is wrong #8

Closed MilesSowden closed 2 years ago

MilesSowden commented 2 years ago

Sorry still learning Github @calvin-curtin the date is assumed from the order of files added. See line 50 in netcdf_translate.sh This is wrong it should read the filename and get the date from it. e.g. I may pass a small subset (e.g December 2019) layer_201912* and this should be used for dating the files.

calvin-curtin commented 2 years ago

Duplicate of #6

MilesSowden commented 2 years ago

This is an issue that must be addressed. It is wrong to assume that a full year is included in the files so the assumption that the first file is 1 Jan is wrong. Item 6 was that there should be validation checks to ensure there was no missing data. I'm less concerned about the missing data than providing the correct date stamp. The date should be found from label_YYYYMMDD and used instead of the incorrect assumption.

MilesSowden commented 2 years ago

see step 6 of https://github.com/ornldaac/create_publication_quality_netcdf/blob/master/NCO_Demo.ipynb Need to fix using the commented bits

!ncap2 -h -s 'time[$time]={0.5, 1.5, 2.5, 3.5, 4.5, ... , 364.5 };' snow_depth_00500m_2006.nc4 snow_depth_00500m_2006_time.nc4

ncap2 -O -h -s 'time=array(0.5, 1, $time);' snow_depth_00500m_2006.nc snow_depth_00500m_2006_time.nc

This is not correct code but I would do the following Time array[i] = date(YYYYMMDD) - start(YYYY0101) + 0.5 and then pass the time array along

calvin-curtin commented 2 years ago

Thanks for clarifying. In this case, an alternative appears to be adding the time variable to each of the converted netCDFs which should generate the final time array more accurately. https://code.mpimet.mpg.de/boards/2/topics/11228

I'm hoping that it shouldn't be too difficult to extract the YYYY, MM and DD from the file names. I'm assuming we'll be using 12:00:00 as the timestamp for each daily file?

MilesSowden commented 2 years ago

Yep first reply on the thread is cdo -setreftime,1900-01-01,00:00:00,1day -setdate,1900-01-01 -setcalendar,standard 2001_1.nc out1.nc

Probably easier to use the setyear, setmonth, and set day functions as cdo -setreftime,1900-01-01,00:00:00,1day -setyear,${YYYY} -setmonth,${MM} -setday,{${DD} -setcalendar,standard 2001_1.nc out1.nc

calvin-curtin commented 2 years ago

@MilesSowden Have created a new branch fix_time to address the date issue in netcdf_translate.sh. Could you please see if this suits your purpose? I am having issues configuring Tiff2NetCDF_ASDAF.sh to run, possibly due to how my .tif files are structured in my directory.

They may be an error on the final merge where albers_conical_equal_area is not found because it was renamed to crs in the temporary files. That should be a simple fix where we rename it later.

calvin-curtin commented 2 years ago

Issue addressed in #11. Reviewed and tested by @MilesSowden