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" |
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
""" | |
Demo using cartopy.util.add_cyclic_point with an xarray Dataset to | |
add a cyclic or wrap-around pixel to the `lon` dimension. This can be useful | |
for plotting with `cartopy` or regridding with `xesmf`. | |
""" | |
import xarray as xr | |
from cartopy.util import add_cyclic_point | |
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
module load NCO/4.7.7-intel-2018b | |
for file in *; do | |
ext=${file##*.} | |
fname=`basename $file .$ext` | |
fname=${fname}_classic.nc | |
echo ${fname} | |
nccopy -k nc7 ${file} ${fname} | |
done; |
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
# Add empty sea-ice variables for ROMS init file. This is intended to make | |
# ROMS run by not failining on missing variables when initializing | |
export FINAL="hunnbunn50_ini_v5.nc" | |
export TMPFILE="tmp.nc" | |
rm -f ${FINAL} | |
rm -f ${TMPFILE} | |
echo "Copying original file to be modified" | |
scp "hunnbunn50_ini_v4.nc" ${FINAL} |
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
directions=(north south east west) | |
scp hunnbunn50_bry_v3.nc ${FINAL} | |
export FINAL=hunnbunn50_bry_v4.nc | |
export TMPFILE=tmp.nc | |
echo "Final output file will be named: " ${FINAL} | |
for dir in "${directions[@]}" | |
do | |
echo "Running SOUTH" |
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
import os, shutil | |
import datetime as datetime | |
from netCDF4 import Dataset | |
import numpy as np | |
import glob | |
import string | |
__author__ = 'Trond Kristiansen' | |
__email__ = 'me (at) trondkristiansen.com' | |
__created__ = datetime.datetime(2015, 10, 5) |
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
import os | |
import datetime as datetime | |
from netCDF4 import Dataset | |
from subprocess import call | |
from itertools import chain | |
__author__ = 'Trond Kristiansen' | |
__email__ = 'me (at) trondkristiansen.com' | |
__created__ = datetime.datetime(2014, 4, 2) | |
__modified__ = datetime.datetime(2014, 4, 2) |
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
# Select the first 12 timesteps of a file | |
cdo -seltimestep,1/12 NORESM_ATM.cam2.hmlvl.2006-2100_delta.nc NORESM_ATM.cam2.hmlvl.2006-2100_delta.nc2 |
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
```python | |
from netCDF4 import Dataset, datetime, date2num,num2date | |
import numpy as np | |
import os | |
from subprocess import call | |
__author__ = 'Trond Kristiansen' | |
__email__ = 'trond.kristiansen@niva.no' | |
__created__ = datetime(2017, 2, 1) | |
__modified__ = datetime(2017, 2, 1) |
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
ncflint -A -C -v ubar_north,vbar_north,u_north,v_north,ubar_west,vbar_west,u_west,v_west -w 0.0,0.0 ws4km_bry_SODA3_19890115_to_20151215_test.nc ws4km_bry_SODA3_19890115_to_20151215_test.nc test.nc |
NewerOlder