Last active
September 22, 2016 06:46
-
-
Save trondkr/769309f5ef6ac1338dde to your computer and use it in GitHub Desktop.
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
#!/bin/sh | |
# Script to extract the last time step of a netcdf file and add it again in the same | |
# file with a time step forward in time. This sort of fakes a later time-step in the file | |
# | |
# Trond Kristiansen, 10.08.2015, 22.09.2016 (NOWMAPS) | |
ncea -F -d ocean_time,20,20 nordsjoen_8km_bry_GLORYS_20130515_to_20141215.nc test.nc | |
ncap -O -s ocean_time=ocean_time+86400*14 test.nc siste.nc | |
ncatted -O -a units,ocean_time,c,c,"seconds since 1948-01-01 00:00:00" siste.nc tmp.nc | |
ncrcat -O nordsjoen_8km_bry_GLORYS_20130515_to_20141215.nc tmp.nc nordsjoen_8km_bry_GLORYS_20130515_to_20141215_v2.nc | |
echo "Finished doing BRY" | |
rm tmp.nc | |
rm siste.nc | |
rm test.nc | |
ncea -F -d ocean_time,20,20 nordsjoen_8km_clim_GLORYS_20130515_to_20141215.nc test.nc | |
ncap -O -s ocean_time=ocean_time+86400*14 test.nc siste.nc | |
ncatted -O -a units,ocean_time,c,c,"seconds since 1948-01-01 00:00:00" siste.nc tmp.nc | |
ncrcat -O nordsjoen_8km_clim_GLORYS_20130515_to_20141215.nc tmp.nc nordsjoen_8km_clim_GLORYS_20130515_to_20141215_v2.nc | |
echo "Finished doing CLIM" | |
rm tmp.nc | |
rm siste.nc | |
rm test.nc | |
cdo chname,salt,SSS nordsjoen_8km_clim_GLORYS_20130515_to_20141215_v2.nc nordsjoen_8km_clim_GLORYS_20130515_to_20141215_SSS_v2.nc | |
echo "Finished doing SSS" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment