geoslurp.tools package

Submodules

geoslurp.tools.Bounds module

class geoslurp.tools.Bounds.BtdBox(s=-90.0, n=90.0, w=0.0, e=360.0, ts=datetime.datetime(1, 1, 1, 0, 0), te=datetime.datetime(9999, 12, 31, 23, 59, 59, 999999), zmin=2.2250738585072014e-308, zmax=1.7976931348623157e+308)

Bases: object

Class which holds a geographical bounding box, a vertical depth range and a datetime range

check()

Check if the ranges are valid

corners()
crop(btdbox)

Crops the bounding box based on the limits available in an other

e()
isGMTCentered()
lonSplit(lon=0)

returns 2 bounding boxes from the current one split at a longitude

n()
poly()
s()
timeSplit(t=None)

return 2 bounding boxes split up at a certain time point

to0_360()

Change the longitude coordinates to span 0 .. 360

toGreenwhich()

returns an instance with the longitude coordinates to span -180 .. 180

w()
wkt()

Returns a WKT represetation of the geographical bounding box

geoslurp.tools.cf module

geoslurp.tools.csv module

geoslurp.tools.csv.columnsFromCSV(line, lookup)

reads column descriptors from comma separated values and creates a list of sqlalchemy columns

geoslurp.tools.csv.fillCSVTable(filename, tablename, lookup, scheme, hskip=0)

Update/populate a database table from a CSV file) This function reads all rows from an open CSV file. The first line is expected to hold the COlumn names, which are mapped to types in the lookup string dictionary

geoslurp.tools.csv.valuesFromCSV(line, names)

geoslurp.tools.netcdftools module

geoslurp.tools.netcdftools.ncStr(ncelem)

extracts a utf-8 encoded string from a netcdf character variable and strips trailing junk

geoslurp.tools.netcdftools.ncSwapLongitude(ncinout, longitudevar='longitude')

swap the longitude representation to span 0..360 or -180..180

geoslurp.tools.netcdftools.nccopyAtt(ncin, ncout, excl=[])

Function to copy attributes from an open netcdf file to another

geoslurp.tools.netcdftools.stackNcFiles(ncout, ncA, ncB, dimension)

Append netcdf file B after file A along the dimension specified

geoslurp.tools.ogrgeom module

geoslurp.tools.ogrgeom.lonlat2ogr(lonlat)

Create a single OGR polygon from an input lonlat array :param lonlat: list like array with longitude latitude pairs :returns a ogr polygon

geoslurp.tools.pandas module

class geoslurp.tools.pandas.PdAccessor(pd_obj)

Bases: object

static load(gsconn, qry, index_col=None, geom_col='geometry')

Read a dataframe from a database engine and convert to GeoDataFrame when a geometry column is present

save(gsconn, tablename, schema='public', overwrite=False, stripuri=False, xrappend_dim=None)

Saves a (geo) dataframe to a database engine

geoslurp.tools.shapelytools module

geoslurp.tools.shapelytools.gdal2rastio(rast)
geoslurp.tools.shapelytools.shpextract(entry)

extract a shapely object from the database entry

geoslurp.tools.shapelytools.wkb2shapely(geom)

geoslurp.tools.spatiallite module

geoslurp.tools.tarsafe module

geoslurp.tools.tarsafe.tar_safe_extractall(tarfid, outdir)

geoslurp.tools.time module

geoslurp.tools.time.decyear2dt(decyear)

Convert a decimal year to a datetime object

geoslurp.tools.time.dt2monthlyinterval(dtin)

retrieves the start end end of a month

geoslurp.tools.time.dt2yearlyinterval(dtin)

Retrieves the start eand end of the year

geoslurp.tools.xarray module

class geoslurp.tools.xarray.XarDsAccessor(xarray_obj)

Bases: object

property append_dim
expand_dim(name, value)
join_at(**kwargs)
static load(gsconn, qry, xrcol='data')

Load xarray dataset and auxiliary columns from a table into a new xarray dataset

save(gsconn, tablename, groupby, schema='public', outofdb=False, overwrite=False)

Saves an xarray object to a geoslurp database

property storage
class geoslurp.tools.xarray.XarGeoslurp(xarray_obj)

Bases: object

property append_dim
expand_dim(name, value)
static expand_dim_impl(ds, name, value)

Expands the data array with a 1-sized dimension and add a coordinate value

join_at(**kwargs)
static join_at_impl(ds, **kwargs)

When reading/writing to geoslurp, join this datarray with others at this dimension/coordinate

save(gsconn, tablename, groupby, schema='public', outofdb=False, overwrite=False)
property storage