| 1 | = Saving and loading EDA2.0 = |
| 2 | |
| 3 | |
| 4 | {{{ |
| 5 | cedric |
| 6 | pg_dump -U postgres -h 192.168.1.104 --schema public --schema wrbd --file "eda2_public_wrbd.sql" --verbose eda2 |
| 7 | pg_dump -U postgres -h 192.168.1.104 --schema ccm21 --file "eda2_ccm21.sql" --verbose eda2 |
| 8 | pg_dump -U postgres -h 192.168.1.104 --schema europe --file "eda2_europe.sql" --verbose eda2 |
| 9 | pg_dump -U postgres -h 192.168.1.104 --table ccm21.riversegments --file "eda2_ccm21_riversegments.sql" --verbose eda2 |
| 10 | pg_dump -U postgres -h 192.168.1.104 --table ccm21.model_mod --table ccm21.resultmodel --table ccm21.temp_western --file "eda2_ccm21_othernew.sql" --verbose eda2 |
| 11 | pg_dump -U postgres -h 192.168.1.104 --schema public --table ccm21.catchments --file "eda2_ccm21_catchments.sql" --verbose eda2 # corrupted ? |
| 12 | elvira |
| 13 | cd c:\data |
| 14 | |
| 15 | psql -U postgres -h localhost --file "eda2_public_wrbd.sql" eda2 |
| 16 | restoring an older version of ccm21 |
| 17 | psql -U postgres -h localhost --file "eda2_ccm21.sql" eda2 (this is from a previous save to restore catchment) |
| 18 | |
| 19 | Now we have a problem with ccm21, we will delete the tables that we do not want to keep from the older version |
| 20 | |
| 21 | psql -U postgres -h localhost -c "drop table ccm21.riversegments cascade" eda2 |
| 22 | psql -U postgres -h localhost --file "eda2_ccm21_othernew.sql" eda2 (tables model_mod, temp_western, and resultmodel) |
| 23 | psql -U postgres -h localhost --file "eda2_ccm21_riversegments.sql" eda2 |
| 24 | psql -U postgres -h localhost --file "eda2_ccm21_europe.sql" eda2 |
| 25 | verification that the version is all right |
| 26 | select count(*) from ccm21.riversegments;--690349 |
| 27 | select count(*) from ccm21.catchments; --745668 |
| 28 | select count(*) from ccm21.riversegments where cum_len_sea>0; --234567 |
| 29 | }}} |
| 30 | |
| 31 | |
| 32 | |
| 33 | == Saving and loading dbeel == |
| 34 | restoring the dbeel |
| 35 | psql -U postgres -h localhost --file "backup_dbeel_12082011.sql" eda2 |
| 36 | |
| 37 | == saving shp files from ccm21 == |
| 38 | |
| 39 | {{{ |
| 40 | use psql2shp |
| 41 | pgsql2shp -f "C:\data\riversegments" -p 5432 -u postgres -g the_geom -r -k eda2 "select * from ccm21.riversegments where wso_id in (select wso_id from europe.wso where area='Ireland');" |
| 42 | }}} |
| 43 | |
| 44 | == Inserting wso1 values == |
| 45 | {{{ |
| 46 | #!sql |
| 47 | /* some checking |
| 48 | SELECT * FROM ccm21.riversegments where wso1_id in (select wso1_id from europe.wso1 where area='Ireland') ORDER BY gid ; |
| 49 | select distinct on (area) area from europe.wso1 |
| 50 | select * from europe.wso where area='Ireland'; |
| 51 | select r.wso_id,r.wso1_id, area from europe.wso e join ccm21.riversegments r on e.wso_id=r.wso_id where area='Ireland' limit 50; |
| 52 | select * from europe.wso1 limit 10; |
| 53 | */ |
| 54 | -- the right request |
| 55 | insert into europe.wso1 (wso_id,wso1_id, area) |
| 56 | select r.wso_id,r.wso1_id, area from europe.wso e join ccm21.riversegments r on e.wso_id=r.wso_id where area='Ireland';--8644 |
| 57 | }}} |
| 58 | [[Image(source:eda/data/Docs/trac/Ireland/qgis.jpg,600px)]] |
| 59 | {{{ |
| 60 | wso_id in (select wso_id from europe.wso where area= 'Ireland') |
| 61 | }}} |
| 62 | |
| 63 | |
| 64 | == TODO list == |
| 65 | 1. dams |
| 66 | 11. Import dam data into postgres |
| 67 | 12. Build the table joining dam data |
| 68 | 13. Run R program to calculate the cumulated number of dams from the sea. |
| 69 | 2. run the program to calculate the clc numbers |
| 70 | 21. run sql script |
| 71 | ["Ireland clc"][[BR]] |
| 72 | 22. run R program |
| 73 | 3. run the program to calculate the distance to the source |
| 74 | 4. import electrofishing data into the dbeel |
| 75 | |
| 76 | ["Ireland_dams"] [[BR]] |
| 77 | ["electrofishing data"][[BR]] |
| 78 | ["Ireland dbeel"][[BR]] |
| 79 | ["Ireland geology"][[BR]] |