Skip to content
This repository has been archived by the owner on Jan 4, 2022. It is now read-only.

Commit

Permalink
Merge pull request #812 from DigitalGlobe/ISS-780-radarsat2productread
Browse files Browse the repository at this point in the history
Replace RadarsatRead operator with Radarsat2ProductRead
  • Loading branch information
Marc Pfister authored Jan 15, 2020
2 parents 059a503 + a9afed5 commit cad87fd
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 20 deletions.
20 changes: 15 additions & 5 deletions gbdxtools/images/radarsat.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,39 @@


class RadarsatDriver(RDADaskImageDriver):
image_option_support = ["proj"]
__image_option_defaults__ = {"proj": "EPSG:4326"}
image_option_support = ["calibration", "proj"]
__image_option_defaults__ = {"calibration": "uncalibrated", "proj": "EPSG:4326"}


class Radarsat(RDABaseImage):
"""
Dask based access to sentinel2 images backed by rda Graphs.
Dask based access to Radarsat images backed by rda Graphs.
Args:
catID (str): The Radarsat record from the Radarsat Catalog Item
calibration (str): Data calibration. Options are 'uncalibrated' (default), 'beta0', 'sigma0' or 'gamma'.
proj (str): EPSG code for the resulting image.
gsd (str): Resolution for the resulting image.
"""
__Driver__ = RadarsatDriver

@property
def _id(self):
return self.__rda_id__

@property
def polarization(self):
return self.options["calibration"]

@classmethod
def _build_graph(cls, record, proj=None, gsd=None):
def _build_graph(cls, record, calibration="uncalibrated", proj=None, gsd=None):
try:
prefix = record['properties']['attributes']['bucketPrefix']
bucket = record['properties']['attributes']['bucketName']
except Exception:
raise AttributeError(
"Radarsat Record missing bucketPrefix and bucketName. Most likely this is permissions issue.")
radarsat = rda.RadarsatTemplate(path=os.path.join(bucket, prefix), nodeId="RadarsatRead")
radarsat = rda.RadarsatTemplate(path=bucket+'/'+prefix, radarsatCalibration=calibration, nodeId="Radarsat2ProductRead")
if proj is not None:
params = ortho_params(proj, gsd=gsd)
radarsat(nodeId="Orthorectify", **params)
Expand Down
11 changes: 6 additions & 5 deletions gbdxtools/rda/rda_templates/templates.json
Original file line number Diff line number Diff line change
Expand Up @@ -270,13 +270,13 @@
]
},
{
"defaultNodeId": "RadarsatRead",
"defaultNodeId": "Radarsat2ProductRead",
"edges": [
{
"destination": "Orthorectify",
"id": "edge-1",
"index": 1,
"source": "RadarsatRead"
"source": "Radarsat2ProductRead"
}
],
"id": "RadarsatTemplate",
Expand All @@ -292,10 +292,11 @@
}
},
{
"id": "RadarsatRead",
"operator": "RadarsatRead",
"id": "Radarsat2ProductRead",
"operator": "Radarsat2ProductRead",
"parameters": {
"path": "${path}"
"path": "${path}",
"calibration": "${radarsatCalibration}"
}
}
]
Expand Down
10 changes: 5 additions & 5 deletions tests/unit/cassettes/test_radarsat_image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ interactions:
response:
body:
string: '[{"isPublic":false,"keywords":["RadarsatTemplate"],"sensors":["Radarsat"],"keynodes":[{"id":"Orthorectify","description":"Orthorectify"}],"description":"Radarsat
and Orthorectify","metadataAuthor":{"firstName":"Brett","familyName":"Cullen","email":"[email protected]"},"templateAuthor":{"firstName":"Brett","familyName":"Cullen","email":"[email protected]"},"datePublished":"2019-04-16T20:06:39.963Z","name":"RadarsatTemplate","templateId":"da0020f5dafbf910e0deb657daa1a0d6f04c3e1044abc59e340941daa40d802e","id":"cfa9c0f4d01d45d5a343fabde21a31da"}]'
and Orthorectify","metadataAuthor":{"firstName":"Brett","familyName":"Cullen","email":"[email protected]"},"templateAuthor":{"firstName":"Brett","familyName":"Cullen","email":"[email protected]"},"datePublished":"2019-04-16T20:06:39.963Z","name":"RadarsatTemplate","templateId":"455fd97e2247bc3b9993cb51a6b709d31a63871a96ec269e52f6fc8b61def272","id":"cfa9c0f4d01d45d5a343fabde21a31da"}]'
headers:
Access-Control-Allow-Headers:
- x-requested-with, X-Auth-Token, Content-Type, Authorization
Expand Down Expand Up @@ -112,12 +112,12 @@ interactions:
User-Agent:
- python-requests/2.21.0
method: GET
uri: https://rda.geobigdata.io/v1/template/da0020f5dafbf910e0deb657daa1a0d6f04c3e1044abc59e340941daa40d802e
uri: https://rda.geobigdata.io/v1/template/455fd97e2247bc3b9993cb51a6b709d31a63871a96ec269e52f6fc8b61def272
response:
body:
string: '{"id":"da0020f5dafbf910e0deb657daa1a0d6f04c3e1044abc59e340941daa40d802e","defaultNodeId":"RadarsatRead","edges":[{"id":"edge-1","index":1,"source":"RadarsatRead","destination":"Orthorectify"}],"nodes":[{"id":"Orthorectify","operator":"Orthorectify","parameters":{"Elevation
string: '{"id":"455fd97e2247bc3b9993cb51a6b709d31a63871a96ec269e52f6fc8b61def272","defaultNodeId":"Radarsat2ProductRead","edges":[{"id":"edge-1","index":1,"source":"Radarsat2ProductRead","destination":"Orthorectify"}],"nodes":[{"id":"Orthorectify","operator":"Orthorectify","parameters":{"Elevation
Source":"","Output Coordinate Reference System":"${Output Coordinate Reference
System}","Output Pixel to World Transform":"","Sensor Model":"null"}},{"id":"RadarsatRead","operator":"RadarsatRead","parameters":{"path":"${path}"}}]}'
System}","Output Pixel to World Transform":"","Sensor Model":"null"}},{"id":"Radarsat2ProductRead","operator":"Radarsat2ProductRead","parameters":{"path":"${path}","calibration":"${radarsatCalibration}"}}]}'
headers:
Access-Control-Allow-Headers:
- x-requested-with, X-Auth-Token, Content-Type, Authorization
Expand Down Expand Up @@ -150,7 +150,7 @@ interactions:
User-Agent:
- python-requests/2.21.0
method: GET
uri: https://rda.geobigdata.io/v1/template/da0020f5dafbf910e0deb657daa1a0d6f04c3e1044abc59e340941daa40d802e/metadata?path=gbdx-receiving-radarsat%2FRS2_OK96607_PK848296_DK779550_XF0W3_20180109_153450_HH_SGF&nodeId=RadarsatRead
uri: https://rda.geobigdata.io/v1/template/455fd97e2247bc3b9993cb51a6b709d31a63871a96ec269e52f6fc8b61def272/metadata?path=gbdx-receiving-radarsat%2FRS2_OK96607_PK848296_DK779550_XF0W3_20180109_153450_HH_SGF&nodeId=Radarsat2ProductRead
response:
body:
string: '{"imageMetadata":{"imageId":"/vsis3/gbdx-receiving-radarsat/RS2_OK96607_PK848296_DK779550_XF0W3_20180109_153450_HH_SGF/imagery_HH.tif","version":1.1,"profileName":"orthoready_image","tilePartition":"0000","tileXOffset":0,"tileYOffset":0,"numXTiles":1,"numYTiles":3239,"tileXSize":38483,"tileYSize":13,"numBands":1,"dataType":"UNSIGNED_SHORT","imageHeight":42105,"imageWidth":38483,"sensorPlatformName":"RADARSAT-2","sensorName":"SAR","vendorDatasetIdentifier":"PDS_06433170:SGF:GSS:610476","acquisitionDate":"2018-01-09T15:34:50.187622Z","colorInterpretation":"PAN","imageBoundsWGS84":"POLYGON
Expand Down
10 changes: 5 additions & 5 deletions tests/unit/cassettes/test_radarsat_image_proj.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ interactions:
response:
body:
string: '[{"isPublic":false,"keywords":["RadarsatTemplate"],"sensors":["Radarsat"],"keynodes":[{"id":"Orthorectify","description":"Orthorectify"}],"description":"Radarsat
and Orthorectify","metadataAuthor":{"firstName":"Brett","familyName":"Cullen","email":"[email protected]"},"templateAuthor":{"firstName":"Brett","familyName":"Cullen","email":"[email protected]"},"datePublished":"2019-04-16T20:06:39.963Z","name":"RadarsatTemplate","templateId":"da0020f5dafbf910e0deb657daa1a0d6f04c3e1044abc59e340941daa40d802e","id":"cfa9c0f4d01d45d5a343fabde21a31da"}]'
and Orthorectify","metadataAuthor":{"firstName":"Brett","familyName":"Cullen","email":"[email protected]"},"templateAuthor":{"firstName":"Brett","familyName":"Cullen","email":"[email protected]"},"datePublished":"2019-04-16T20:06:39.963Z","name":"RadarsatTemplate","templateId":"455fd97e2247bc3b9993cb51a6b709d31a63871a96ec269e52f6fc8b61def272","id":"cfa9c0f4d01d45d5a343fabde21a31da"}]'
headers:
Access-Control-Allow-Headers:
- x-requested-with, X-Auth-Token, Content-Type, Authorization
Expand Down Expand Up @@ -112,12 +112,12 @@ interactions:
User-Agent:
- python-requests/2.21.0
method: GET
uri: https://rda.geobigdata.io/v1/template/da0020f5dafbf910e0deb657daa1a0d6f04c3e1044abc59e340941daa40d802e
uri: https://rda.geobigdata.io/v1/template/455fd97e2247bc3b9993cb51a6b709d31a63871a96ec269e52f6fc8b61def272
response:
body:
string: '{"id":"da0020f5dafbf910e0deb657daa1a0d6f04c3e1044abc59e340941daa40d802e","defaultNodeId":"RadarsatRead","edges":[{"id":"edge-1","index":1,"source":"RadarsatRead","destination":"Orthorectify"}],"nodes":[{"id":"Orthorectify","operator":"Orthorectify","parameters":{"Elevation
string: '{"id":"455fd97e2247bc3b9993cb51a6b709d31a63871a96ec269e52f6fc8b61def272","defaultNodeId":"Radarsat2ProductRead","edges":[{"id":"edge-1","index":1,"source":"Radarsat2ProductRead","destination":"Orthorectify"}],"nodes":[{"id":"Orthorectify","operator":"Orthorectify","parameters":{"Elevation
Source":"","Output Coordinate Reference System":"${Output Coordinate Reference
System}","Output Pixel to World Transform":"","Sensor Model":"null"}},{"id":"RadarsatRead","operator":"RadarsatRead","parameters":{"path":"${path}"}}]}'
System}","Output Pixel to World Transform":"","Sensor Model":"null"}},{"id":"Radarsat2ProductRead","operator":"Radarsat2ProductRead","parameters":{"path":"${path}","calibration":"${radarsatCalibration}"}}]}'
headers:
Access-Control-Allow-Headers:
- x-requested-with, X-Auth-Token, Content-Type, Authorization
Expand Down Expand Up @@ -150,7 +150,7 @@ interactions:
User-Agent:
- python-requests/2.21.0
method: GET
uri: https://rda.geobigdata.io/v1/template/da0020f5dafbf910e0deb657daa1a0d6f04c3e1044abc59e340941daa40d802e/metadata?path=gbdx-receiving-radarsat%2FRS2_OK96607_PK848296_DK779550_XF0W3_20180109_153450_HH_SGF&nodeId=Orthorectify&Output+Coordinate+Reference+System=EPSG%3A3857&Sensor+Model=null&Elevation+Source=&Output+Pixel+to+World+Transform=
uri: https://rda.geobigdata.io/v1/template/455fd97e2247bc3b9993cb51a6b709d31a63871a96ec269e52f6fc8b61def272/metadata?path=gbdx-receiving-radarsat%2FRS2_OK96607_PK848296_DK779550_XF0W3_20180109_153450_HH_SGF&nodeId=Orthorectify&Output+Coordinate+Reference+System=EPSG%3A3857&Sensor+Model=null&Elevation+Source=&Output+Pixel+to+World+Transform=
response:
body:
string: '{"imageMetadata":{"imageId":"/vsis3/gbdx-receiving-radarsat/RS2_OK96607_PK848296_DK779550_XF0W3_20180109_153450_HH_SGF/imagery_HH.tif","version":1.1,"profileName":"georectified_image","tilePartition":"0000","tileXOffset":0,"tileYOffset":0,"numXTiles":220,"numYTiles":235,"tileXSize":256,"tileYSize":256,"numBands":1,"dataType":"UNSIGNED_SHORT","imageHeight":59726,"imageWidth":56011,"sensorPlatformName":"RADARSAT-2","sensorName":"SAR","vendorDatasetIdentifier":"PDS_06433170:SGF:GSS:610476","acquisitionDate":"2018-01-09T15:34:50.187622Z","colorInterpretation":"PAN","imageBoundsWGS84":"POLYGON
Expand Down

0 comments on commit cad87fd

Please sign in to comment.