I am currently working on a project where I have two datasets. I have been able to write a program to match records between the two datasets on timestamp and lat/long positions.
Example: datasetA
{"LATITUDE": 29.83,
"LONGITUDE": 106.73,
"MINUTE": 0,
"SECOND": 2,
"MONTH": 10,
"WIND_DIRECTION": 219,
"WIND_SPEED": 3.0,
"YEAR": 2019}
example: dataset2
{"LATITUDE": 29.83,
"LONGITUDE": 106.73,
"MINUTE": 0,
"SECOND": 2,
"MONTH": 10,
"WIND_SPEED": 3.0,
"YEAR": 2019},
Now, say I have another record in dataset2
, which is close to the number for lat/long and timestamp.
Example dataset2a
{"LATITUDE": 30.83,
"LONGITUDE": 107.73,
"MINUTE": 0,
"SECOND": 4,
"MONTH": 10,
"WIND_SPEED": 3.0,
"YEAR": 2019}
Below is my code so far for matching, it is matching on exact lat/long + minute & second. If I wanted to introduce an interval to this, say to match on seconds near 1 minute of time and lat/long to be 1 - 2 integers. How would I go at implementing this?
if (z['latitude'] == True and z['longitude'] == True) and z['minute'] == True:
trueMatches += 1
dict3 = {**dictA , **dictB}
list.append(dict3)
print(dict3)
It doesn't have to follow my code, but I'm matching dictionaries within a list. Any general approach will be helpful.