Last active
March 13, 2022 19:35
-
-
Save trondkr/6ae27a07424c15f585e7c0cbdf62fe98 to your computer and use it in GitHub Desktop.
Add fake point to NetCDF4 file to wrap globally
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for file in era5*.nc | |
do | |
name=${file##*/} | |
base=${name%.nc} | |
newfile="${base}_halo.nc" | |
if [ ! -f "$newfile" ] | |
then | |
echo "$0: Creating '${file}'" | |
cdo sethalo,0,1 "$file" "$newfile" | |
fi | |
done |
Updated to check if file already exists or not
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This function uses
CDO
to add a fake number to ensure that the longitudes are completely wrapping the globe -180 to 180. Thanks to CDO community for help : https://code.mpimet.mpg.de/boards/1/topics/12323