Downloading and reading data#
Functions to download and read data.
- h2ss.data.download_data(url, data_dir, file_name, known_hash=None)[source]#
Download data and store it in the specified directory using Pooch.
Parameters#
- urlstr
URL from which the data will be downloaded
- data_dirstr
Directory to store the downloaded data
- file_namestr
Name of the downloaded data file with its extension (not full path)
- known_hashstr
SHA256 hash of downloaded file
Notes#
This only downloads data if necessary, i.e. if the data file does not already exist in the directory.
- h2ss.data.kish_basin_extent(dat_path)[source]#
Read the extent of the Kish Basin data.
Parameters#
- dat_pathstr
Path to the Kish Basin data files
Returns#
- geopandas.GeoSeries
GeoPandas geoseries of the extent polygon
- h2ss.data.read_dat_file(dat_path)[source]#
Read XYZ halite data layers into an Xarray dataset.
Parameters#
- dat_pathstr
Path to the DAT (ASCII XYZ) files
Returns#
- tuple[xarray.Dataset, geopandas.GeoSeries]
Xarray dataset of the XYZ data and GeoPandas geoseries of the extent
- h2ss.data.kish_basin_data_depth_adjusted(dat_path, bathymetry_path)[source]#
Read halite data with adjusted depths and its extent.
Parameters#
- dat_pathstr
Path to the DAT (ASCII XYZ) files
- bathymetry_pathstr
Path to the bathymetry netCDF file
Returns#
- tuple[xarray.Dataset, geopandas.GeoSeries]
Xarray dataset of the halite data and GeoPandas geoseries of the extent
Notes#
A hacky workaround was used to prevent multiple grid mappings in the resulting Xarray dataset by first assigning a variable of the desired mapping and then multiplying it by zero prior to involving variables which originally had a different mapping.
- h2ss.data.bathymetry_layer(dat_extent, bathymetry_path)[source]#
Bathymetry layer for plotting.
Parameters#
- dat_extentgeopandas.GeoSeries
Extent of the data
- bathymetry_pathstr
Path to the bathymetry netCDF file
Returns#
- xarray.Dataset
Xarray dataset of the halite data