Closed MilesSowden closed 1 year ago
@MilesSowden The script for netcdf_translate.sh was adapted from https://github.com/ornldaac/create_publication_quality_netcdf/blob/master/NCO_Demo.ipynb.
line 27
initial_file=$3 # Initial File: e.g. active_fires_10000_20010101_v20220211.nc
line 32
ncks -h -A -v crs $initial_file $final_file
initial_file in this case, could have been the filename any of temporary daily netCDF files. The purpose of this was to ensure that the crs remained consistent for the final merged netCDF file. It was probably unnecessary as the crs should pass through when merging the netCDFs as long as it was the same for every single temporary daily netCDF file, which is the case.
line 45
for f in {sOutFolder}/tmp_{layer_name}_${start_year}*.nc; do ncrename -h -v albers_conical_equal_area,crs $f; done
This line was added as it was mentioned that "Naming the projection system variable to crs is more standardized and allows ncecat (the netCDF operator that merges the 365 files into 1) to correctly assigns the time dimension".
I wonder in this case, whether specifying the projection during the gdal_translate makes it so that we don't need to rename the albers-conical-equal-area to crs.
@MilesSowden Are you able to confirm that the crs codes in the final file match the required project?
@calvin-curtin , the correct projection is applied but the CRS description needs to be passed in when I parse the XML file (this week). At the moment it simply says "CRS" which is obviously wrong.
ditched geotiffs
@calvin-curtin does passing the projection change the crs codes in netcdf_translate.sh
see line 27
MS Fix We don't have an existing NetCDF file only TIFFs!!! Why is this required?
initial_file=$3 # Initial File: e.g. active_fires_10000_20010101_v20220211.nc
see line 38 echo "converting "${layername}${start_year} for f in ${layername}${start_year}.tif; do gdal_translate -of netCDF -co WRITELONLAT=YES $sProjection $f ${sOutFolder}/tmp${f%.}.nc; done
Renaming albers-conical-equal-area to crs
for f in ${sOutFolder}/tmp_${layername}${start_year}*.nc; do ncrename -h -v albers_conical_equal_area,crs $f; done
see line 45
Copying the crs variable from a previous netCDF daily file
MS ncks -h -A -v crs $initial_file $final_file