-
Notifications
You must be signed in to change notification settings - Fork 2
/
mlotst.py
39 lines (31 loc) · 1.02 KB
/
mlotst.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
if __name__ == "__main__":
from supported_variables.utils.supported_variable import (
supported_variable,
preprocessing,
)
import utils.utils as utils
else:
from supported_variables.utils.supported_variable import (
supported_variable,
preprocessing,
)
import supported_variables.utils.utils as utils
from utils.import_cdo import cdo
from typing import List, Tuple, Union
import os.path as path
@supported_variable
class Mlotst:
realm = "o"
# Mixed layer data is not saved in annual mean data,
# so we need to calculate the annual mean from monthly data
@preprocessing(Mlotst, "BRIDGE-monthly-to-annual")
def preprocessing_1(
inputs: List[Tuple[str, str]], output_directory: str
) -> List[Tuple[str, str]]:
file, var = inputs[0]
name = path.basename(file).replace(".nc", ".out.nc")
output = path.join(output_directory, name)
output = cdo.sellonlatbox(
"-180,180,90,-90", input=f" -yearmean {file}", options="-r -f nc"
)
return [(output, var)]