Skip to content

Commit

Permalink
lint 2
Browse files Browse the repository at this point in the history
  • Loading branch information
tomsail committed Jul 15, 2024
1 parent 552a16a commit 14d85fe
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions pyposeidon/telemac.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,9 +318,7 @@ def write_meteo_on_mesh(
data_chunk = da.zeros((len(time_chunk), len(node_chunk)), chunks=(n_time_chunk, n_node_chunk))
for it, t_ in enumerate(time_chunk):
tmp = np.ravel(np.transpose(era_chunk.isel(time=it_chunk + it)[var_name].values))
data_chunk[it, :] = interp(
tmp, vert, wgts, u_x, g_x
) # Assuming interp is defined elsewhere
data_chunk[it, :] = interp(tmp, vert, wgts, u_x, g_x) # Assuming interp is defined elsewhere
coords = {"time": time_chunk, "node": node_chunk}
ds = xr.Dataset({var_name: (("time", "node"), data_chunk)}, coords=coords)
region = {"time": slice(it_chunk, t_end), "node": slice(ins, end_node)}
Expand Down Expand Up @@ -463,9 +461,7 @@ def write_cli(inTel, ds, outCli=None, tel_module="telemac2d", global_=True):
if boundary_type == "open":
# Get previous and next node indices in a circular manner
prev_node = bnd[i - 1] if i > 0 else bnd[-2] # -2 to skip the repeated last node
next_node = (
bnd[i + 1] if i < len(bnd) - 2 else bnd[0]
) # Wrapping around to the first node
next_node = bnd[i + 1] if i < len(bnd) - 2 else bnd[0] # Wrapping around to the first node
# Get boundary types for previous and next nodes
prev_boundary_type = node_to_type.get(prev_node, "Unknown")
next_boundary_type = node_to_type.get(next_node, "Unknown")
Expand Down Expand Up @@ -701,9 +697,7 @@ def config(self, config_file=None, output=False, **kwargs):

# hotstart
if self.restart is not None:
hotout = int(
(self.restart - self.rdate).total_seconds() / (params["tstep"] * params["tstep_graph"])
)
hotout = int((self.restart - self.rdate).total_seconds() / (params["tstep"] * params["tstep_graph"]))
params["hotstart"] = True
params["restart_tstep"] = hotout

Expand Down Expand Up @@ -1196,9 +1190,7 @@ def read_folder(self, rfolder, **kwargs):
sh = [self.params["opt"][x] for x in ["start_hour", "utc_start"]] # get time attrs
sd = sd + pd.to_timedelta("{}H".format(sh[0] + sh[1])) # complete start_date

ed = sd + pd.to_timedelta(
"{}D".format(self.params["core"]["rnday"])
) # compute end date based on rnday
ed = sd + pd.to_timedelta("{}D".format(self.params["core"]["rnday"])) # compute end date based on rnday

self.start_date = sd # set attrs
self.end_date = ed
Expand Down

0 comments on commit 14d85fe

Please sign in to comment.