Commit e65b9455 authored by BorjaEst's avatar BorjaEst
Browse files

Improve pytest source switching coordinate names

parent 1d025103
......@@ -9,13 +9,13 @@ def tco3(year_range):
for year in year_range:
xr.Dataset(
data_vars=dict(
tco3=(["lon", "lat", "time"],
tco3=(["longitude", "latitude", "time"],
np.random.rand(21, 11, 12))
),
coords=dict(
lon=coordinate.lon(num=21),
lat=coordinate.lat(num=11),
plev=coordinate.plev(num=4),
longitude=coordinate.lon(num=21),
latitude=coordinate.lat(num=11),
pressure_level=coordinate.plev(num=4),
time=coordinate.time(num=12, start=year)
),
attrs=dict(description="Test tco3 dataset")
......@@ -26,13 +26,13 @@ def vmro3(year_range):
for year in year_range:
xr.Dataset(
data_vars=dict(
vmro3=(["lon", "lat", "plev", "time"],
vmro3=(["longitude", "latitude", "pressure_level", "time"],
np.random.rand(21, 11, 4, 12))
),
coords=dict(
lon=coordinate.lon(num=21),
lat=coordinate.lat(num=11),
plev=coordinate.plev(num=4),
longitude=coordinate.lon(num=21),
latitude=coordinate.lat(num=11),
pressure_level=coordinate.plev(num=4),
time=coordinate.time(num=12, start=year)
),
attrs=dict(description="Test vmro3 dataset")
......@@ -43,15 +43,15 @@ def combined(year_range):
for year in year_range:
xr.Dataset(
data_vars=dict(
tco3=(["lon", "lat", "time"],
tco3=(["longitude", "latitude", "time"],
np.random.rand(21, 11, 12)),
vmro3=(["lon", "lat", "plev", "time"],
vmro3=(["longitude", "latitude", "pressure_level", "time"],
np.random.rand(21, 11, 4, 12))
),
coords=dict(
lon=coordinate.lon(num=21),
lat=coordinate.lat(num=11),
plev=coordinate.plev(num=4),
longitude=coordinate.lon(num=21),
latitude=coordinate.lat(num=11),
pressure_level=coordinate.plev(num=4),
time=coordinate.time(num=12, start=year)
),
attrs=dict(description="Test ozone dataset")
......
......@@ -10,16 +10,16 @@ def time(num=12, start=2000, end=None):
start = pd.Timestamp("{}-01-01".format(start))
end = pd.Timestamp("{}-01-01".format(end))
t = np.linspace(start.value, end.value, num + 1)[0:-1]
return ('time', pd.to_datetime(t))
return pd.to_datetime(t)
def lat(num=11):
return ('lat', np.linspace(-90, 90, num))
return np.linspace(-90, 90, num)
def lon(num=21):
return ('lon', np.linspace(-180, 180, num))
return np.linspace(-180, 180, num)
def plev(num=4):
return ('plev', np.logspace(1, 4, num))
return np.logspace(1, 4, num)
......@@ -5,33 +5,33 @@ SourceSplit:
paths: SourceSplit/tco3_????.nc
coordinates:
time: time
lat: lat
lon: lon
lat: latitude
lon: longitude
ModelVMRO3:
vmro3_zm:
name: vmro3
paths: SourceSplit/vmro3_????.nc
coordinates:
time: time
plev: plev
lat: lat
lon: lon
plev: pressure_level
lat: latitude
lon: longitude
ModelALL:
tco3_zm:
name: tco3
paths: SourceSplit/tco3_????.nc
coordinates:
time: time
lat: lat
lon: lon
lat: latitude
lon: longitude
vmro3_zm:
name: vmro3
paths: SourceSplit/vmro3_????.nc
coordinates:
time: time
plev: plev
lat: lat
lon: lon
plev: pressure_level
lat: latitude
lon: longitude
SourceMerged:
ModelTCO3:
tco3_zm:
......@@ -39,31 +39,31 @@ SourceMerged:
paths: SourceMerged/merged_????.nc
coordinates:
time: time
lat: lat
lon: lon
lat: latitude
lon: longitude
ModelVMRO3:
vmro3_zm:
name: vmro3
paths: SourceMerged/merged_????.nc
coordinates:
time: time
plev: plev
lat: lat
lon: lon
plev: pressure_level
lat: latitude
lon: longitude
ModelALL:
tco3_zm:
name: tco3
paths: SourceMerged/merged_????.nc
coordinates:
time: time
lat: lat
lon: lon
lat: latitude
lon: longitude
vmro3_zm:
name: vmro3
paths: SourceMerged/merged_????.nc
coordinates:
time: time
plev: plev
lat: lat
lon: lon
plev: pressure_level
lat: latitude
lon: longitude
Supports Markdown
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