Skip to content

Commit

Permalink
Add a couple more arg types and tidy imports in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
omad committed Nov 16, 2016
1 parent 5358bfb commit 43a3ae4
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
4 changes: 4 additions & 0 deletions datacube/model/__init__.py
Expand Up @@ -513,6 +513,10 @@ class CRS(object):
"""

def __init__(self, crs_str):
"""
:param crs_str: string representation of a CRS, often an EPSG code like 'EPSG:4326'
"""
if isinstance(crs_str, CRS):
crs_str = crs_str.crs_str
self.crs_str = crs_str
Expand Down
7 changes: 7 additions & 0 deletions datacube/storage/storage.py
Expand Up @@ -268,6 +268,13 @@ def whats_my_transform(self, src):
def create_netcdf_storage_unit(filename,
crs, coordinates, variables, variable_params, global_attributes=None,
netcdfparams=None):
"""
Create a NetCDF file on disk.
:param pathlib.Path filename: filename to write to
:param datacube.model.CRS crs: Datacube CRS object defining the spatial projection
:return: open netCDF4.Dataset object
"""
if filename.exists():
raise RuntimeError('Storage Unit already exists: %s' % filename)

Expand Down
1 change: 0 additions & 1 deletion tests/storage/test_netcdfwriter.py
Expand Up @@ -4,7 +4,6 @@

import netCDF4
import numpy
from osgeo import osr

from datacube.model import Variable, CRS
from datacube.storage.netcdf_writer import create_netcdf, create_coordinate, create_variable, netcdfy_data, \
Expand Down
1 change: 0 additions & 1 deletion tests/storage/test_storage.py
Expand Up @@ -17,7 +17,6 @@

import numpy
import netCDF4
from pathlib import Path
from affine import Affine
import xarray

Expand Down

0 comments on commit 43a3ae4

Please sign in to comment.