Skip to content

Commit

Permalink
⏪ Bring back PyGMT VCS dependency and associated tests
Browse files Browse the repository at this point in the history
Reinstate pygmt in our Pipfile (bumping it up a few versions) and enable pygmt-related tests once more. Basically reverting ea40d50 now that we've manually updated various dependencies in the Pipfile.
  • Loading branch information
weiji14 committed Jun 1, 2019
1 parent 299a032 commit b391724
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 40 deletions.
2 changes: 1 addition & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ numpy = "==1.16.4"
onnx_chainer = "==1.4.1"
optuna = "==0.11.0"
pandas = "==0.24.2"
pygmt = {editable = true, ref = "0.0.1a0-36-gb1e7b75", git = "https://github.com/weiji14/pygmt.git"}
quilt = "==2.9.15"
rasterio = "==1.0.13"
rtree = "==0.8.3"
scikit-image = "==0.15.0"
tqdm = "==4.32.1"
xarray = "==0.12.1"

[dev-packages]
behave = "==1.2.6"
Expand Down
17 changes: 10 additions & 7 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions data_prep.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@
"output_type": "stream",
"text": [
"Python : 3.6.6 | packaged by conda-forge | (default, Oct 11 2018, 14:33:06) \n",
"Geopandas : 0.4.1\n",
"GMT : 0.0.1a0+31.g97c2b4a\n",
"Numpy : 1.16.2\n",
"Geopandas : 0.5.0\n",
"GMT : 0.0.1a0+36.gb1e7b75\n",
"Numpy : 1.16.4\n",
"Rasterio : 1.0.13\n",
"Scikit-image : 0.14.2\n",
"Scikit-image : 0.15.0\n",
"Xarray : 0.12.1\n"
]
}
Expand All @@ -51,7 +51,7 @@
"import zipfile\n",
"\n",
"import geopandas as gpd\n",
"# import pygmt as gmt\n",
"import pygmt as gmt\n",
"import IPython.display\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
Expand Down Expand Up @@ -815,10 +815,10 @@
"\n",
" >>> xyz_data = 1000*pd.DataFrame(np.random.RandomState(seed=42).rand(60).reshape(20, 3))\n",
" >>> region = get_region(xyz_data=xyz_data)\n",
" >>> grid = xyz_to_grid(xyz_data=xyz_data, region=region, spacing=250) # doctest: +SKIP\n",
" >>> grid.to_array().shape # doctest: +SKIP\n",
" >>> grid = xyz_to_grid(xyz_data=xyz_data, region=region, spacing=250)\n",
" >>> grid.to_array().shape\n",
" (1, 5, 5)\n",
" >>> grid.to_array().values # doctest: +SKIP\n",
" >>> grid.to_array().values\n",
" array([[[403.17618 , 544.92535 , 670.7824 , 980.75055 , 961.47723 ],\n",
" [379.0757 , 459.26407 , 314.38297 , 377.78555 , 546.0469 ],\n",
" [450.67664 , 343.26 , 88.391594, 260.10492 , 452.3337 ],\n",
Expand Down Expand Up @@ -1615,5 +1615,5 @@
}
},
"nbformat": 4,
"nbformat_minor": 2
"nbformat_minor": 4
}
10 changes: 5 additions & 5 deletions data_prep.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# extension: .py
# format_name: hydrogen
# format_version: '1.2'
# jupytext_version: 1.0.3
# jupytext_version: 1.1.4-rc1
# kernelspec:
# display_name: deepbedmap
# language: python
Expand Down Expand Up @@ -35,7 +35,7 @@
import zipfile

import geopandas as gpd
# import pygmt as gmt
import pygmt as gmt
import IPython.display
import matplotlib.pyplot as plt
import numpy as np
Expand Down Expand Up @@ -379,10 +379,10 @@ def xyz_to_grid(
>>> xyz_data = 1000*pd.DataFrame(np.random.RandomState(seed=42).rand(60).reshape(20, 3))
>>> region = get_region(xyz_data=xyz_data)
>>> grid = xyz_to_grid(xyz_data=xyz_data, region=region, spacing=250) # doctest: +SKIP
>>> grid.to_array().shape # doctest: +SKIP
>>> grid = xyz_to_grid(xyz_data=xyz_data, region=region, spacing=250)
>>> grid.to_array().shape
(1, 5, 5)
>>> grid.to_array().values # doctest: +SKIP
>>> grid.to_array().values
array([[[403.17618 , 544.92535 , 670.7824 , 980.75055 , 961.47723 ],
[379.0757 , 459.26407 , 314.38297 , 377.78555 , 546.0469 ],
[450.67664 , 343.26 , 88.391594, 260.10492 , 452.3337 ],
Expand Down
1 change: 0 additions & 1 deletion features/data_prep.feature
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ Feature: Data preparation
| https://data.cresis.ku.edu/data/rds/2017_Antarctica_Basler/csv_good/Data_20171204_02.csv | highres/Data_20171204_02.csv | 53cef7a0d28ff92b30367514f27e888efbc32b1bda929981b371d2e00d4c671b |
| http://ramadda.nerc-bas.ac.uk/repository/entry/get/Polar%20Data%20Centre/DOI/Rutford%20Ice%20Stream%20bed%20elevation%20DEM%20from%20radar%20data/bed_WGS84_grid.txt?entryid=synth%3A54757cbe-0b13-4385-8b31-4dfaa1dab55e%3AL2JlZF9XR1M4NF9ncmlkLnR4dA%3D%3D | highres/bed_WGS84_grid.txt | 7396e56cda5adb82cecb01f0b3e01294ed0aa6489a9629f3f7e8858ea6cb91cf |

@skip
Scenario Outline: Grid datasets
Given a collection of raw high resolution datasets <input_pattern>
When we process the data through <pipeline_file>
Expand Down
1 change: 0 additions & 1 deletion features/deepbedmap.feature
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ Feature: DeepBedMap
As a scientist,
We want a model that produces realistic images from many open datasets

@skip
Scenario Outline: Determine high resolution bed
Given some view of Antarctica <bounding_box>
When we gather low and high resolution images related to that view
Expand Down
49 changes: 33 additions & 16 deletions test_ipynb.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,25 @@
" region = get_region(xyz_data=xyz_data)\n",
"Expecting nothing\n",
"ok\n",
"Trying:\n",
" grid = xyz_to_grid(xyz_data=xyz_data, region=region, spacing=250)\n",
"Expecting nothing\n",
"ok\n",
"Trying:\n",
" grid.to_array().shape\n",
"Expecting:\n",
" (1, 5, 5)\n",
"ok\n",
"Trying:\n",
" grid.to_array().values\n",
"Expecting:\n",
" array([[[403.17618 , 544.92535 , 670.7824 , 980.75055 , 961.47723 ],\n",
" [379.0757 , 459.26407 , 314.38297 , 377.78555 , 546.0469 ],\n",
" [450.67664 , 343.26 , 88.391594, 260.10492 , 452.3337 ],\n",
" [586.09906 , 469.74008 , 216.8168 , 486.9802 , 642.2116 ],\n",
" [451.4794 , 652.7244 , 325.77896 , 879.8973 , 916.7921 ]]],\n",
" dtype=float32)\n",
"ok\n",
"2 items had no tests:\n",
" data_prep\n",
" data_prep.parse_datalist\n",
Expand All @@ -212,9 +231,9 @@
" 2 tests in data_prep.get_region\n",
" 3 tests in data_prep.get_window_bounds\n",
" 3 tests in data_prep.selective_tile\n",
" 2 tests in data_prep.xyz_to_grid\n",
"22 tests in 9 items.\n",
"22 passed and 0 failed.\n",
" 5 tests in data_prep.xyz_to_grid\n",
"25 tests in 9 items.\n",
"25 passed and 0 failed.\n",
"Test passed.\n"
]
}
Expand Down Expand Up @@ -484,14 +503,13 @@
" When we download it to highres/bed_WGS84_grid.txt # features/steps/test_data_prep.py:13\n",
" Then the local file should have this 7396e56cda5adb82cecb01f0b3e01294ed0aa6489a9629f3f7e8858ea6cb91cf checksum # features/steps/test_data_prep.py:19\n",
"\n",
" @skip\n",
" Scenario Outline: Grid datasets -- @1.1 ASCII text files to grid # features/data_prep.feature:27\n",
" Given a collection of raw high resolution datasets bed_WGS84_grid.txt # None\n",
" When we process the data through bed_WGS84_grid.json # None\n",
" And interpolate the xyz data table to bed_WGS84_grid.nc # None\n",
" Then a high resolution raster grid is returned # None\n",
" Scenario Outline: Grid datasets -- @1.1 ASCII text files to grid # features/data_prep.feature:26\n",
" Given a collection of raw high resolution datasets bed_WGS84_grid.txt # features/steps/test_data_prep.py:25\n",
" When we process the data through bed_WGS84_grid.json # features/steps/test_data_prep.py:38\n",
" And interpolate the xyz data table to bed_WGS84_grid.nc # features/steps/test_data_prep.py:45\n",
" Then a high resolution raster grid is returned # features/steps/test_data_prep.py:54\n",
"\n",
" Scenario Outline: Tile datasets -- @1.1 Raster grids to tile # features/data_prep.feature:37\n",
" Scenario Outline: Tile datasets -- @1.1 Raster grids to tile # features/data_prep.feature:36\n",
" Given a big highres raster grid 2010tr.nc # features/steps/test_data_prep.py:60\n",
" And a collection of square bounding boxes \"model/train/tiles_3031.geojson\" # features/steps/test_data_prep.py:70\n",
" When we crop the big raster grid using those bounding boxes # features/steps/test_data_prep.py:80\n",
Expand Down Expand Up @@ -548,12 +566,11 @@
" In order to create a great map of Antarctica's bed\n",
" As a scientist,\n",
" We want a model that produces realistic images from many open datasets\n",
" @skip\n",
" Scenario Outline: Determine high resolution bed -- @1.1 Bounding box views of Antarctica # features/deepbedmap.feature:17\n",
" Given some view of Antarctica -1593714.328,-164173.7848,-1575464.328,-97923.7848 # None\n",
" When we gather low and high resolution images related to that view # None\n",
" And pass those images into our trained neural network model # None\n",
" Then a four times upsampled super resolution bed elevation map is returned # None\n",
" Scenario Outline: Determine high resolution bed -- @1.1 Bounding box views of Antarctica # features/deepbedmap.feature:16\n",
" Given some view of Antarctica -1593714.328,-164173.7848,-1575464.328,-97923.7848 # features/steps/test_deepbedmap.py:6\n",
" When we gather low and high resolution images related to that view # features/steps/test_deepbedmap.py:14\n",
" And pass those images into our trained neural network model # features/steps/test_deepbedmap.py:30\n",
" Then a four times upsampled super resolution bed elevation map is returned # features/steps/test_deepbedmap.py:38\n",
"\n"
]
}
Expand Down

0 comments on commit b391724

Please sign in to comment.