Commit 12c1881d authored by BorjaEst's avatar BorjaEst
Browse files

Spellfix, coordinade by coordinate

parent 6eaf8971
......@@ -5,14 +5,14 @@ CCMI-1:
tco3_zm:
name: toz
paths: Ccmi/mon/toz/*.nc
coordinades:
coordinates:
time: time
lat: lat
lon: lon
vmro3_zm:
name: vmro3
paths: Ccmi/mon/toz/*.nc
coordinades:
coordinates:
time: time
plev: plev
lat: lat
......
......@@ -53,9 +53,9 @@ class Model:
with xr.open_mfdataset(fnames) as dataset:
dataset = dataset.rename({
tco3_zm['name']: 'tco3_zm',
tco3_zm['coordinades']['time']: 'time',
tco3_zm['coordinades']['lat']: 'lat',
tco3_zm['coordinades']['lon']: 'lon'
tco3_zm['coordinates']['time']: 'time',
tco3_zm['coordinates']['lat']: 'lat',
tco3_zm['coordinates']['lon']: 'lon'
})['tco3_zm'].to_dataset()
self._tco3_zm = dataset.mean(dim='lon')
......@@ -66,9 +66,9 @@ class Model:
with xr.open_mfdataset(fnames) as dataset:
dataset = dataset.rename({
vmro3_zm['name']: 'vmro3_zm',
vmro3_zm['coordinades']['time']: 'time',
vmro3_zm['coordinades']['plev']: 'plev',
vmro3_zm['coordinades']['lat']: 'lat',
vmro3_zm['coordinades']['lon']: 'lon'
vmro3_zm['coordinates']['time']: 'time',
vmro3_zm['coordinates']['plev']: 'plev',
vmro3_zm['coordinates']['lat']: 'lat',
vmro3_zm['coordinates']['lon']: 'lon'
})['vmro3_zm'].to_dataset()
self._vmro3_zm = dataset.mean(dim='lon')
......@@ -17,27 +17,27 @@ indexes = {
}
def data_vars(coordinades):
"""Creates a mock n-array with coordinade values"""
alias = tuple(coordinades.values())
dim = tuple(len(indexes[c]) for c in coordinades)
def data_vars(coordinates):
"""Creates a mock n-array with coordinate values"""
alias = tuple(coordinates.values())
dim = tuple(len(indexes[c]) for c in coordinates)
return alias, np.ones(dim),
def map_coord(coordinades):
"""Creates a mock array by coordinade"""
return {alias: indexes[c] for c, alias in coordinades.items()}
def map_coord(coordinates):
"""Creates a mock array by coordinate"""
return {alias: indexes[c] for c, alias in coordinates.items()}
def dataset(name, coordinades):
def dataset(name, coordinates):
"""Creates a dataset acording to the global module indexes"""
return xr.Dataset(
{name: data_vars(coordinades)},
coords=map_coord(coordinades)
{name: data_vars(coordinates)},
coords=map_coord(coordinates)
)
def netcdf(path, name, coordinades, **kwarg):
def netcdf(path, name, coordinates, **kwarg):
"""Creates or appends data to a mock netcdf file"""
ds = dataset(name, coordinades)
ds = dataset(name, coordinates)
utils.to_netcdf(path, name, ds)
......@@ -3,14 +3,14 @@ CCMI-1:
tco3_zm:
name: toz
dir: Ccmi/mon/toz
coordinades:
coordinates:
time: time
lat: lat
lon: lon
vmro3_zm:
name: vmro3
dir: Ccmi/mon/vmro3
coordinades:
coordinates:
time: time
plev: plev
lat: lat
......@@ -20,7 +20,7 @@ ECMWF:
tco3_zm:
name: tco3
dir: Ecmwf/Era5
coordinades:
coordinates:
lon: longitude
lat: latitude
time: time
......@@ -28,14 +28,14 @@ ECMWF:
tco3_zm:
name: toz
dir: Ecmwf/Erai
coordinades:
coordinates:
time: time
lat: latitude
lon: longitude
vmro3_zm:
name: vmro3
dir: Ecmwf/Erai
coordinades:
coordinates:
time: time
plev: level
lat: latitude
......
......@@ -3,7 +3,7 @@ ECMWF:
vmro3_zm: # Correct variable
name: vmro3
dir: Ecmwf/Erai
coordinades:
coordinates:
time: time
plev: level
lat: latitude
......@@ -11,7 +11,7 @@ ECMWF:
tco3_zm: # Incorrect variable
name: non_existing_var
dir: Ecmwf/Erai
coordinades:
coordinates:
time: time
lat: latitude
lon: longitude
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