Skip to content
Snippets Groups Projects
Commit efb2b2be authored by tuckersiegel's avatar tuckersiegel
Browse files

removal of leap days

parent 91bf2b96
No related branches found
No related tags found
No related merge requests found
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
There is a ~90gb folder of the data that is needed to be able to upload the data to mongodb. There is a ~90gb folder of the data that is needed to be able to upload the data to mongodb.
IGNORES ALL LEAP DAYS
Go to ```/docs``` to view the Swagger generated API docs, and to play around with the server Go to ```/docs``` to view the Swagger generated API docs, and to play around with the server
The mongodb is hosted on mongodb atlas. PLEASE do not run ```python to_mongo.py``` or ```python pull_data.py``` without asking Tucker first. You need the data and will overwrite all data on the mongodb server. The mongodb is hosted on mongodb atlas. PLEASE do not run ```python to_mongo.py``` or ```python pull_data.py``` without asking Tucker first. You need the data and will overwrite all data on the mongodb server.
......
...@@ -26,9 +26,6 @@ var normalsSchema = mongoose.Schema({ ...@@ -26,9 +26,6 @@ var normalsSchema = mongoose.Schema({
max_temps: { max_temps: {
type: Array, type: Array,
}, },
normal: {
type: Boolean,
}
}); });
var Model = module.exports = mongoose.model('normals', normalsSchema, "normals"); var Model = module.exports = mongoose.model('normals', normalsSchema, "normals");
...@@ -13,6 +13,11 @@ print (r.status_code) ...@@ -13,6 +13,11 @@ print (r.status_code)
print (r.json()) print (r.json())
print (time.time() - t) print (time.time() - t)
print () print ()
r = requests.post("http://localhost:4000/api/soybean/daily/2016", data=data)
print (r.status_code)
print (r.json())
print (time.time() - t)
print ()
r = requests.post("http://localhost:4000/api/soybean/normal", data=data) r = requests.post("http://localhost:4000/api/soybean/normal", data=data)
print (r.status_code) print (r.status_code)
print (r.json()) print (r.json())
......
...@@ -61,6 +61,19 @@ for year in years: ...@@ -61,6 +61,19 @@ for year in years:
tmins = data.tmin.data tmins = data.tmin.data
tmaxs = data.tmax.data tmaxs = data.tmax.data
if is_leap_year(year): # extra day in leap year screws everything up
tmin_1 = tmins[:59]
tmin_2 = tmins[60:]
tmax_1 = tmaxs[:59]
tmin_2 = tmaxs[60:]
tmins = np.concatenate([tmin_1, tmin_2], axis=0)
tmaxs = np.concatenate([tmax_1, tmin_2], axis=0)
locs = [] locs = []
count = 0 count = 0
...@@ -92,7 +105,6 @@ for year in years: ...@@ -92,7 +105,6 @@ for year in years:
t["min_temps"] = list([float(a) for a in tmin_]) t["min_temps"] = list([float(a) for a in tmin_])
t["max_temps"] = list([float(a) for a in tmax_]) t["max_temps"] = list([float(a) for a in tmax_])
t["_id"] = _id t["_id"] = _id
t["normal"] = False
locs.append(t) locs.append(t)
...@@ -190,9 +202,6 @@ for i in tqdm.tqdm(x): ...@@ -190,9 +202,6 @@ for i in tqdm.tqdm(x):
t["min_temps"] = list([float(a) for a in tmin_]) t["min_temps"] = list([float(a) for a in tmin_])
t["max_temps"] = list([float(a) for a in tmax_]) t["max_temps"] = list([float(a) for a in tmax_])
t["_id"] = _id t["_id"] = _id
t["normal"] = True
locs.append(t) locs.append(t)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment