Skip to content

Commit

Permalink
add diff converter. Returns field1 - field2
Browse files Browse the repository at this point in the history
  • Loading branch information
asmundb committed Sep 20, 2024
1 parent 22de76b commit b08959e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pysurfex/read.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,9 @@ def __init__(self, name, initial_time, defs, conf, fileformat):

if self.name == "none" or self.name == "analysis":
self.var = self.create_variable(fileformat, defs, conf[self.name])
elif name == "diff":
self.field1 = self.create_variable(fileformat, defs, conf[self.name]["field1"])
self.field2 = self.create_variable(fileformat, defs, conf[self.name]["field2"])
elif name == "rh2q":
self.r_h = self.create_variable(fileformat, defs, conf[self.name]["rh"])
self.temp = self.create_variable(fileformat, defs, conf[self.name]["t"])
Expand Down Expand Up @@ -316,6 +319,9 @@ def read_time_step(self, geo, validtime, cache):
# Specific reading for each converter
if self.name == "none" or self.name == "analysis":
field = self.var.read_variable(geo, validtime, cache)
elif self.name == "diff":
field = self.field1.read_variable(geo, validtime, cache) \
- self.field2.read_variable(geo, validtime, cache)
elif self.name == "windspeed" or self.name == "winddir":
field_x = self.x_wind.read_variable(geo, validtime, cache)
field_y = self.y_wind.read_variable(geo, validtime, cache)
Expand Down

0 comments on commit b08959e

Please sign in to comment.