Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
datacirco-prepare-data
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
leximpact
DataCirco
datacirco-prepare-data
Commits
52fedc58
Commit
52fedc58
authored
6 months ago
by
benoit-cty
Browse files
Options
Downloads
Patches
Plain Diff
Agrandi la zone
parent
4e2d21b7
Branches
Branches containing commit
No related tags found
1 merge request
!52
Prepare prod
Pipeline
#19251
failed
6 months ago
Stage: init
Stage: download
Stage: populate_db
Stage: export_json
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
datacirco/modules_data/meteo_data.py
+4
-4
4 additions, 4 deletions
datacirco/modules_data/meteo_data.py
populate_db/meteo_convert.py
+1
-2
1 addition, 2 deletions
populate_db/meteo_convert.py
with
5 additions
and
6 deletions
datacirco/modules_data/meteo_data.py
+
4
−
4
View file @
52fedc58
...
...
@@ -303,7 +303,7 @@ class GetMeteo:
avg(m.temperature) as temperature,
avg(m.precipitation) as precipitation
from zone_circo c
join meteo_era5_circo m on (ST_DWithin(c.wkb_geometry, m.geom, 0.
15
))
join meteo_era5_circo m on (ST_DWithin(c.wkb_geometry, m.geom, 0.
20
))
where ref =
'
{
circo
}
'
and annee between 1991 and 2020
group by 1,2) as monthly
...
...
@@ -339,7 +339,7 @@ class GetMeteo:
avg(m.temperature) as temperature,
avg(m.precipitation) as precipitation
from zone_circo c
join meteo_era5_circo m on (ST_DWithin(c.wkb_geometry, m.geom, 0.
15
))
join meteo_era5_circo m on (ST_DWithin(c.wkb_geometry, m.geom, 0.
20
))
where ref =
'
{
circo
}
'
group by 1,2) as monthly
group by 1
...
...
@@ -374,7 +374,7 @@ class GetMeteo:
FROM crosstab(
$$SELECT meteo.mois, meteo.annee, avg(meteo.temperature) as temperature FROM (
SELECT m.* FROM meteo_era5_circo m
JOIN zone_circo c on (ST_DWithin(c.wkb_geometry, m.geom, 0.
15
))
JOIN zone_circo c on (ST_DWithin(c.wkb_geometry, m.geom, 0.
20
))
where c.ref =
'
{
circo
}
'
) as meteo
GROUP BY 1,2
ORDER BY 1,2$$,
...
...
@@ -408,7 +408,7 @@ class GetMeteo:
FROM crosstab(
$$SELECT meteo.mois, meteo.annee, avg(meteo.precipitation) as precipitation FROM (
SELECT m.* FROM meteo_era5_circo m
JOIN zone_circo c on (ST_DWithin(c.wkb_geometry, m.geom, 0.
15
))
JOIN zone_circo c on (ST_DWithin(c.wkb_geometry, m.geom, 0.
20
))
where c.ref =
'
{
circo
}
'
) as meteo
GROUP BY 1,2
ORDER BY 1,2$$,
...
...
This diff is collapsed.
Click to expand it.
populate_db/meteo_convert.py
+
1
−
2
View file @
52fedc58
...
...
@@ -16,8 +16,7 @@ MONTH = [str(i + 1).zfill(2) for i in range(12)]
years
=
range
(
START_YEAR
,
END_YEAR
+
1
)
# year_month = [("1962","05"), ("2020","05")] # For testing
year_month
=
[(
y
,
m
)
for
y
in
years
for
m
in
MONTH
]
len
(
year_month
)
print
(
f
"
Processing
{
len
(
year_month
)
}
months :
{
year_month
}
"
)
print
(
f
"
Processing
{
len
(
year_month
)
}
months.
"
)
def
convert_crs
(
ds
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment