Exemplo n.º 1
0
    def find_wells_in_lat_lon(self, lats, lons):
        lons = sorted(lons)
        lats = sorted(lats)
        dfs = []

        coords = [lats[0], lons[0], lats[1], lons[1]]
        box = ",".join(["{:.4f}".format(c) for c in coords])
        r = self.get("GetGridData?Box={box}".format(box=box))
        df = r.df.drop_duplicates().rename(
            columns={"dhno": "dh_no", "mapnum": "unit_no", "obsnumber": "obs_no"}
        )
        for key in ["obs_no", "name", "unit_no"]:
            if not key in df:
                df[key] = ""
            df.loc[df[key].isnull(), key] = ""
        return Wells([Well(**r.to_dict()) for _, r in df.iterrows()])
Exemplo n.º 2
0
 def find_wells(self, input_text, **kwargs):
     ids = parse_well_ids(input_text, **kwargs)
     dh_nos = [x for id_type, x in ids if id_type == "dh_no"]
     unit_nos = [x for id_type, x in ids if id_type == "unit_no"]
     obs_nos = [x for id_type, x in ids if id_type == "obs_no"]
     r1 = self.get("GetUnitNumberSearchData", params={"MAPNUM": ",".join(unit_nos)})
     r2 = self.get(
         "GetObswellNumberSearchData", params={"OBSNUMBER": ",".join(obs_nos)}
     )
     df = (
         pd.concat([r1.df, r2.df], sort=False)
         .drop_duplicates()
         .rename(
             columns={"dhno": "dh_no", "mapnum": "unit_no", "obsnumber": "obs_no"}
         )
     )
     for key in ["obs_no", "name"]:
         if not key in df:
             df[key] = ""
         df.loc[df[key].isnull(), key] = ""
     return Wells([Well(**r.to_dict()) for _, r in df.iterrows()])
def test_well_with_property_kwarg():
    well = Well(203536, unit_no=662711249, unit_hyphen="6627-11249")
def test_well_bool():
    well = Well(203536, unit_no="6627-11249")
    assert well
def test_well_one_is_not_like_another():
    well1 = Well(203536, unit_no="6627-11249")
    dh_no = 203536
    assert well1 != dh_no
def test_well_equality_2():
    well1 = Well(203536, unit_no="6627-11249")
    well2 = Well(203537)
    assert well1 != well2
def test_well_hash():
    well = Well(203536, unit_no="6627-11249")
    assert {well: "value"}[well] == "value"
def test_well_unit_no_id():
    well = Well(203536, unit_no="6627-11249")
    assert well.id == "6627-11249"
def test_well_name_in_title():
    well = Well(207050, unit_no="6627-11246", name="OVAL BORE")
    assert well.title == "6627-11246 / OVAL BORE"
def test_well_path_safe_repr_keep_prefix():
    well = Well(28255, unit_no="6528-1127", obs_no="YAT124")
    assert (well.path_safe_repr(remove_prefix=False) == "'YAT124'")
def test_well_path_safe_repr():
    well = Well(28255, unit_no="6528-1127", obs_no="YAT124")
    assert well.path_safe_repr() == "'YAT124'"
def test_well_repr():
    well = Well(28255, unit_no="6528-1127", obs_no="YAT124")
    assert str(well) == "'YAT124'"
def test_well_manual(attr_name, expected_value):
    well = Well(28255, unit_no="6528-1127", obs_no="YAT124")
    assert getattr(well, attr_name) == expected_value
def test_well_dh_no_missing_attrs(attr_name, expected_value):
    well = Well(28255)
    assert getattr(well, attr_name) == expected_value
def test_well_dh_no():
    well = Well(28255)
def test_well_missing_dh_no():
    with pytest.raises(TypeError):
        well = Well()