Commit 841a980c authored by jan vogelsang's avatar jan vogelsang

Adding data

parent 381cfe5e
.nc filter=lfs diff=lfs merge=lfs -text
*.nc filter=lfs diff=lfs merge=lfs -text
gridtype = lonlat
gridsize = 6481800
xsize = 3601
ysize = 1800
xfirst = 0.00
xinc = 0.1
yfirst = -89.95
yinc = 0.1
This source diff could not be displayed because it is stored in LFS. You can view the blob instead.
This source diff could not be displayed because it is stored in LFS. You can view the blob instead.
This source diff could not be displayed because it is stored in LFS. You can view the blob instead.
from cdo import Cdo
import sys
cdo = Cdo()
cdo.Debug = True
path_to_input = sys.argv[1]
path_to_output = sys.argv[2]
center = float(sys.argv[3]) % 360
# ----- Preprocessing START -----
# Add another column at the end of the grid, interpolate values for this column
# set time format to hours since 1970 and center the map around the given longitude
cdo.setreftime("1970-01-01,00:00:00", input="-sellonlatbox,{lon0},{lon1},-90,90 -settunits,hours -setcalendar,standard -masklonlatbox,0,360,-90,90 -remapnn,custom_grid.txt {input}".format(lon0=center-180, lon1=center+180.1, input=path_to_input), output=path_to_output, options = "-P 8 -f nc4 -z zip")
# ----- Preprocessing END -----
......@@ -5,6 +5,7 @@ Stage: build
%post
apt update && apt install python3 cdo python3-cdo git -y
pip install netCDF4 xarray cdo
%labels
......@@ -13,7 +14,7 @@ Stage: build
%help
This container converts a data file in the grib format to netcdf.
This container preprocesses a data file in the netcdf format for subsequent visualization.
%runscript
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment