Skip to content

Commit

Permalink
replace screen length well filter with unsat well filter
Browse files Browse the repository at this point in the history
  • Loading branch information
canewton committed Nov 7, 2024
1 parent 84f623a commit c5d0d68
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
10 changes: 5 additions & 5 deletions npsat_manager/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,8 @@ class ModelRun(models.Model):

# the range should be between 0 - 801;
# 801 is reserved for the maximum value possible, when passing to message to mantis, set it to 10000
screen_length_range_max = models.DecimalField(null=True, blank=True, decimal_places=2, max_digits=5)
screen_length_range_min = models.DecimalField(null=True, blank=True, decimal_places=2, max_digits=5)
unsat_range_max = models.DecimalField(null=True, blank=True, decimal_places=2, max_digits=5)
unsat_range_min = models.DecimalField(null=True, blank=True, decimal_places=2, max_digits=5)

# scenarios
# here we use explicit fields and set a limit to each
Expand Down Expand Up @@ -429,9 +429,9 @@ def input_message(self):
range_max = str(self.depth_range_max) if self.depth_range_max != 801 else "10000"
msg += f" DepthRange {str(self.depth_range_min)} {range_max}"

if self.screen_length_range_min is not None and self.screen_length_range_max is not None:
range_max = str(self.screen_length_range_max) if self.depth_range_max != 801 else "10000"
msg += f" ScreenLenRange {str(self.screen_length_range_min)} {range_max}"
if self.unsat_range_min is not None and self.unsat_range_max is not None:
range_max = str(self.unsat_range_max) if self.depth_range_max != 801 else "10000"
msg += f" UnsatRange {str(self.unsat_range_min)} {range_max}"

msg += " ENDofMSG\n"
return msg
Expand Down
16 changes: 8 additions & 8 deletions npsat_manager/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,8 @@ class Meta:
"applied_simulation_filter",
"depth_range_min",
"depth_range_max",
"screen_length_range_min",
"screen_length_range_max"
"unsat_range_min",
"unsat_range_max"
)
depth = 0 # should mean that modifications get included in the initial request
extra_kwargs = {"user": {"required": False}}
Expand All @@ -290,8 +290,8 @@ def create(self, validated_data):
applied_simulation_filter = validated_data["applied_simulation_filter"]
depth_range_min = validated_data.get("depth_range_min", None)
depth_range_max = validated_data.get("depth_range_max", None)
screen_length_range_min = validated_data.get("screen_length_range_min", None)
screen_length_range_max = validated_data.get("screen_length_range_max", None)
unsat_range_min = validated_data.get("unsat_range_min", None)
unsat_range_max = validated_data.get("unsat_range_max", None)


# check if there is a BAU created by CURRENT USER
Expand All @@ -310,8 +310,8 @@ def create(self, validated_data):
if (applied_simulation_filter):
BAU_condition &= Q(depth_range_min=depth_range_min)
BAU_condition &= Q(depth_range_max=depth_range_max)
BAU_condition &= Q(screen_length_range_min=screen_length_range_min)
BAU_condition &= Q(screen_length_range_max=screen_length_range_max)
BAU_condition &= Q(unsat_range_min=unsat_range_min)
BAU_condition &= Q(unsat_range_max=unsat_range_max)
BAU_condition &= Q(sim_end_year=sim_end_year)
BAU_instances = models.ModelRun.objects.filter(BAU_condition)
for region in regions_data:
Expand Down Expand Up @@ -340,8 +340,8 @@ def create(self, validated_data):
applied_simulation_filter=applied_simulation_filter,
depth_range_min=depth_range_min,
depth_range_max=depth_range_max,
screen_length_range_min=screen_length_range_min,
screen_length_range_max=screen_length_range_max,
unsat_range_min=unsat_range_min,
unsat_range_max=unsat_range_max,
)
else:
BAU_model = models.ModelRun.objects.create(
Expand Down
4 changes: 2 additions & 2 deletions npsat_manager/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,8 @@ def test_ModelRun_create(self):
# ),
depth_range_max=350.22,
depth_range_min=20.11,
screen_length_range_max=100.00,
screen_length_range_min=0.876,
unsat_range_max=100.00,
unsat_range_min=0.876,
applied_simulation_filter=True
)
model_run1.regions.add(models.Region.objects.get(name="Central Valley"))
Expand Down
4 changes: 2 additions & 2 deletions npsat_manager/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,8 +434,8 @@ def retrieve(self, request, *args, **kwargs):
porosity=instance.porosity,
depth_range_min=instance.depth_range_min,
depth_range_max=instance.depth_range_max,
screen_length_range_min=instance.screen_length_range_min,
screen_length_range_max=instance.screen_length_range_max,
unsat_range_min=instance.unsat_range_min,
unsat_range_max=instance.unsat_range_max,
sim_end_year=instance.sim_end_year,
)

Expand Down

0 comments on commit c5d0d68

Please sign in to comment.