Skip to content

Commit

Permalink
black
Browse files Browse the repository at this point in the history
  • Loading branch information
ashjbarnes committed Apr 30, 2024
1 parent aca3f48 commit 171ef0a
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions regional_mom6/regional_mom6.py
Original file line number Diff line number Diff line change
Expand Up @@ -1577,7 +1577,7 @@ def setup_era5(self, era5_path):
all_files = []
for path in paths_per_year:
# Use glob to find all files that match the pattern
files = list(path.glob(f'{fname}*.nc'))
files = list(path.glob(f"{fname}*.nc"))
# Add the files to the all_files list
all_files.extend(files)

Expand All @@ -1587,8 +1587,6 @@ def setup_era5(self, era5_path):
chunks={"longitude": 100, "latitude": 100},
)



## Cut out this variable to our domain size
rawdata[fname] = longitude_slicer(
ds,
Expand Down Expand Up @@ -1619,12 +1617,8 @@ def setup_era5(self, era5_path):

if fname == "2d":
## Calculate specific humidity from dewpoint temperature
dewpoint = 8.07131 - 1730.63 / (
233.426 + rawdata["2d"]["d2m"] - 273.15
)
humidity = (
(0.622 / rawdata["sp"]["sp"]) * (10**dewpoint) * 101325 / 760
)
dewpoint = 8.07131 - 1730.63 / (233.426 + rawdata["2d"]["d2m"] - 273.15)
humidity = (0.622 / rawdata["sp"]["sp"]) * (10**dewpoint) * 101325 / 760
q = xr.Dataset(data_vars={"q": humidity})

q.q.attrs = {"long_name": "Specific Humidity", "units": "kg/kg"}
Expand All @@ -1636,9 +1630,7 @@ def setup_era5(self, era5_path):
elif fname == "crr":
## Calculate total rain rate from convective and total
trr = xr.Dataset(
data_vars={
"trr": rawdata["crr"]["crr"] + rawdata["lsrr"]["lsrr"]
}
data_vars={"trr": rawdata["crr"]["crr"] + rawdata["lsrr"]["lsrr"]}
)

trr.trr.attrs = {
Expand Down

0 comments on commit 171ef0a

Please sign in to comment.