{
"info": {
"author": "Kel Markert",
"author_email": "kel.markert@gmail.com",
"bugtrack_url": null,
"classifiers": [],
"description": "# RasterSmith\nRasterSmith is a Python package aimed at making the analysis of satellite remote sensing data products easier.\n\n### Installing RasterSmith\nCurrently, RasterSmith is under active development but is packaged and available to install via `pip`. To install the package, you can use pip install for your Python environment:\n\n```\npip install rastersmith\n```\n\nOr, you can install the package manually using the following commands1:\n\n```\ngit clone https://github.com/kmarkert/rastersmith.git\ncd rastersmith\npip install -e .\n```\n\n1Note: this method will only install the RasterSmith package in the current path. So, to use you will have to point the Python environment to this path to import. Or, you can install manually in the \"site-packages\" directory of your Python installation.\n\n\n\n\n### Using RasterSmith\nHere is a quick example of what you can do with RasterSmith. More detailed on the use of the package is provided in the [documentation](https://rastersmith.readthedocs.io/).\n\nTo begin, let's import rastersmith in an IPython environment.\n\n```python\nIn [1]: import rastersmith as rs\n```\n\nThe core strength of RasterSmith is the ability to read in geographic raster data and format it in a way that is internally consistent. For example, we will read in a [gridded VIIRS surface reflectance product](https://earthdata.nasa.gov/earth-observation-data/near-real-time/download-nrt-data/viirs-nrt) from NASA LANCE and explore the RasterSmith data structure.\n\n```python\nIn [2]: viirs = rs.Viirs.read('VNP09GA_NRT.A2018247.h27v07.001.h5')\n\nIn [3]: viirs\nOut[3]:\n\narray([[[[[8373],\n ...,\n [ 0]]],\n\n\n ...,\n\n\n [[[3755],\n ...,\n [ 0]]]]], dtype=int16)\nCoordinates:\n * z (z) int64 0\n * lat (lat) float64 2.223e+06 2.223e+06 2.223e+06 2.222e+06 2.222e+06 ...\n * lon (lon) float64 1.001e+07 1.001e+07 1.001e+07 1.001e+07 1.001e+07 ...\n * band (band) \n```\n\n\nFrom the resulting output we can see that the gridded VIIRS data was read in with the native sinusoidal projection (even though the coordinate labels lat/lon). **RasterSmith uses the WGS84 Geographic Coordinate System (EPSG: 4326) as the internal projection for comparing different raster datasets.**\n\nFor us now to use the VIIRS data within RasterSmith with other datasets, we must now reproject the data into the WGS84 projection. RasterSmith has a reprojection function to make it easier for users to change between coordinate systems:\n\n```python\n# Apply reprojection to VIIRS data\nIn [5]: viirsProj = rs.mapping.reproject(viirs,outEpsg='4326',outResolution=500)\n\n# Plot the reprojected VIIRS data\nIn [6]: viirsProj.sel(band='M7').plot(robust=True,cmap='gray')\nOut[6]: \n```\n\n\nWe can now see that the actual VIIRS data is transformed to the WGS84 coordinate system and the coordinates along the Y and X axes are actual in latitude and longitude. Now, let's explore some more RasterSmith functionality for processing data.\n\nEach xarray DataArray that RasterSmith creates has a `mask` band. This is a band that describes good data pixels (value of `1`) and poor data pixels to not use (value of `0`) based on internal satellite data product QA information. RasterSmith has a method to mask poor data within the object so any future operations will use only good data. First, let's explore what the mask looks like for this VIIRS dataset\n\n```python\nIn [7]: viirsProj.sel(band='mask').plot()\nOut[7]: \n```\n\n\nNow let's look at how to apply the mask using the internal raster methods:\n\n```python\nIn [8] viirsMasked = viirsProj.raster.applyMask()\n# an equivalent syntax using xarray will be: viirsMasked = viirsproj.where(viirs.proj.sel(band='mask') == 1)\n\nIn [9] viirsMasked.sel(band='M7').plot(robust=True)\nOut[9] \n```\n\n\nAs we can see, when the mask is applied, all pixels in the `mask` band with a value of `0` will be given a `nan` value. This is beneficial when we want to start taking advantage of the multi-temporal acquisitions and make mosaics (using the `time` dimension).\n\nHere is an example to create an 8-day mean composite from multiple image acquisitions. We will write a separate script to use the RasterSmith package to read in a preprocess multiple VIIRS datasets and create an 8-day composite. We will call this script 'viirsComposite.py'.\n\n```python\nimport rastersmith as rs\nimport xarray as xr\n\n# specify which files to read in and process\ninfiles = ['VNP09GA_NRT.A2018247.h27v07.001.h5',\n 'VNP09GA_NRT.A2018248.h27v07.001.h5',\n 'VNP09GA_NRT.A2018249.h27v07.001.h5',\n 'VNP09GA_NRT.A2018250.h27v07.001.h5',\n 'VNP09GA_NRT.A2018251.h27v07.001.h5',\n 'VNP09GA_NRT.A2018252.h27v07.001.h5',\n 'VNP09GA_NRT.A2018253.h27v07.001.h5',\n 'VNP09GA_NRT.A2018254.h27v07.001.h5']\n\n# read in the files using rastersmith\nviirsDs = map(lambda x: rs.Viirs.read(x),infiles)\n\n# apply the reprojection method to WGS84 for all rasters\nviirsDsProj = map(lambda x: rs.mapping.reproject(x,outEpsg='4326',outResolution=500),viirsDs)\n\n# apply the internal mask for all rasters\nviirsDsMasked = map(lambda x: x.raster.applyMask(), viirsDsProj)\n\n# merge all of the rasters into one DataArray by time dimension\nviirsMerged = xr.concat(viirsDsMasked,dim='time')\n\n# calculate the mean value for each pixel along the time dimension\nviirsMosaic = viirsMerged.mean(dim='time')\n```\n\nNow let's run our script in our IPython session, time how long it takes to process, and view the results.\n\n```python\nIn [10] %time %run viirsComposite.py\nCPU times: user 1min 46s, sys: 16.3 s, total: 2min 2s\nWall time: 45 s\n\nIn [11] viirsMosaic.sel(band='M7').plot(robust=True)\nOut[11] \n```\n\n\nAs we can see from benchmarking the processing, it takes about 45s to read and process the 8 VIIRS files and create a mean composite from all the data. We also see from the output of image that only clear (non-cloudy) pixels are being used to create the composite making, however, there are a few missing pixels still.\n\nThese examples are meant to highlight the use of RasterSmith for reading in, creating a consistent format, and preprocessing of satellite remote sensing products. For more information on the internal data structure and available functions within RasterSmith please see the [documentation](https://rastersmith.readthedocs.io/).\n\n### Why RasterSmith?\nMany satellite data products provided come in different (1) data formats, (2) number of bands, (3) spatial resolution/extent, and (4) geographic projections making the combined use of the data product often difficult to handle and use for non-experts. RasterSmith is used to take the differing data product and make a common format with a set of helper functions for use in analysis.\n\nTake two commonly used remote sensing data products from [LandSat](https://landsat.usgs.gov/) and the [Visible Infrared Imaging Radiometer Suite](https://jointmission.gsfc.nasa.gov/viirs.html) (VIIRS). LandSat is distributed as GeoTIFF files, one file for each band, along with associated metadata in a separate file, where as VIIRS data is distributed as a single HDF5 file with embedded metadata. While individual LandSat GeoTIFF files can be easily used in GIS software, preprocessing is needed to use multiple bands together as a single variable. On the other hand, VIIRS data distributed as HDF5 data is difficult to read in and use within traditional GIS software. Ultimately, using the two datasets in conjunction with ArcGIS or QGIS has proven difficult due to the varying formats that the data is distributed in.\n\n\n\n### RasterSmith data structure\nRasterSmith is built upon the [xarray](http://xarray.pydata.org/en/stable/) package1 and uses the already existing N-D labled array functionality from xarray to assist in harmonizing satellite data products. Thus, the satellite data products read in using RasterSmith adhere to the xarray philosophy with labeled dimensions.\n\n\n1 *Technically the core RasterSmith raster class is an [accessor](http://xarray.pydata.org/en/latest/generated/xarray.register_dataset_accessor.html#xarray.register_dataset_accessor) to the xarray DataArray class allowing access to the RasterSmith class methods directly from xarray objects.*\n\n\n",
"description_content_type": "text/markdown",
"docs_url": null,
"download_url": "",
"downloads": {
"last_day": -1,
"last_month": -1,
"last_week": -1
},
"home_page": "http://github.com/kmarkert/rastersmith",
"keywords": "",
"license": "MIT",
"maintainer": "",
"maintainer_email": "",
"name": "rastersmith",
"package_url": "https://pypi.org/project/rastersmith/",
"platform": "",
"project_url": "https://pypi.org/project/rastersmith/",
"project_urls": {
"Homepage": "http://github.com/kmarkert/rastersmith"
},
"release_url": "https://pypi.org/project/rastersmith/0.0.3/",
"requires_dist": null,
"requires_python": "",
"summary": "RasterSmith is a package to preprocess different NASA Earth observing satellite data products into common resolution, spatial reference, and format for easy analysis and processing across sensors.",
"version": "0.0.3"
},
"last_serial": 4335283,
"releases": {
"0.0.1": [
{
"comment_text": "",
"digests": {
"md5": "b26f7c62be3170eb07086960e3f08aea",
"sha256": "ce35f9285f04cf182c7b85678757a035e9379a8905aa53b1ac0aaf1653f1a0eb"
},
"downloads": -1,
"filename": "rastersmith-0.0.1-py2-none-any.whl",
"has_sig": false,
"md5_digest": "b26f7c62be3170eb07086960e3f08aea",
"packagetype": "bdist_wheel",
"python_version": "py2",
"requires_python": null,
"size": 24689,
"upload_time": "2018-09-12T22:01:18",
"url": "https://files.pythonhosted.org/packages/1d/2a/4313d1efdbbc2d3ada937e2b1b459d0034fe584fca749276d3815209d9ea/rastersmith-0.0.1-py2-none-any.whl"
},
{
"comment_text": "",
"digests": {
"md5": "dc96e8d8900f32af6c35485528eb15b2",
"sha256": "486b16945c84457a31d53dc9555b0d64694b8ee62cc2b1e3b411c2d7f396d452"
},
"downloads": -1,
"filename": "rastersmith-0.0.1.tar.gz",
"has_sig": false,
"md5_digest": "dc96e8d8900f32af6c35485528eb15b2",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 21862,
"upload_time": "2018-09-12T22:01:19",
"url": "https://files.pythonhosted.org/packages/e0/6e/19461991a193f131bfeab38ba7590b556befc93a941c1c5edce33250ac7c/rastersmith-0.0.1.tar.gz"
}
],
"0.0.2": [
{
"comment_text": "",
"digests": {
"md5": "558f521765ace8ab2e78a557b044b807",
"sha256": "9750fa964b10f2fec3602e9212a8e95befbfefca854652af3c893a8a207e0904"
},
"downloads": -1,
"filename": "rastersmith-0.0.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "558f521765ace8ab2e78a557b044b807",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 27281,
"upload_time": "2018-09-14T03:35:22",
"url": "https://files.pythonhosted.org/packages/52/59/be08ac6e05b5d5e9f056ba2672ecbbb001f1417884de39b45e17800a3781/rastersmith-0.0.2-py3-none-any.whl"
},
{
"comment_text": "",
"digests": {
"md5": "0fd0d55677c3c9460c6be84d4cfa73e7",
"sha256": "841022f1600707d960c99384799dee2aa2235be64b9d5f4503d6ed6eef5e0527"
},
"downloads": -1,
"filename": "rastersmith-0.0.2.tar.gz",
"has_sig": false,
"md5_digest": "0fd0d55677c3c9460c6be84d4cfa73e7",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 27810,
"upload_time": "2018-09-14T03:35:24",
"url": "https://files.pythonhosted.org/packages/0a/0c/361f63080429fa2bbd925e6f438310312912b50473f998afaacc999f4c27/rastersmith-0.0.2.tar.gz"
}
],
"0.0.3": [
{
"comment_text": "",
"digests": {
"md5": "d5c3c883c3d4948425af2d1ab062a197",
"sha256": "b33091f7dc085a1a1a812f5cd5ea4fddb3082313d4b08bfe90724c39c4bac03a"
},
"downloads": -1,
"filename": "rastersmith-0.0.3-py2-none-any.whl",
"has_sig": false,
"md5_digest": "d5c3c883c3d4948425af2d1ab062a197",
"packagetype": "bdist_wheel",
"python_version": "py2",
"requires_python": null,
"size": 27261,
"upload_time": "2018-10-03T06:04:43",
"url": "https://files.pythonhosted.org/packages/e3/4e/7f7a04d40a2bcfd0227496d906e9c5f8d1a53848d7101b15edd3d4c9e680/rastersmith-0.0.3-py2-none-any.whl"
},
{
"comment_text": "",
"digests": {
"md5": "2070c9f8e58e71fd273cef8608f928d9",
"sha256": "2d8a9ceee417bdaed236bd0cfcceacca13fb3eb74889a80a658d529f4b019855"
},
"downloads": -1,
"filename": "rastersmith-0.0.3.tar.gz",
"has_sig": false,
"md5_digest": "2070c9f8e58e71fd273cef8608f928d9",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 27777,
"upload_time": "2018-10-03T06:04:45",
"url": "https://files.pythonhosted.org/packages/5a/29/3115d82f357d72347a67380c4100de3e9beeb24536f13b83f8d9c7cb1370/rastersmith-0.0.3.tar.gz"
}
]
},
"urls": [
{
"comment_text": "",
"digests": {
"md5": "d5c3c883c3d4948425af2d1ab062a197",
"sha256": "b33091f7dc085a1a1a812f5cd5ea4fddb3082313d4b08bfe90724c39c4bac03a"
},
"downloads": -1,
"filename": "rastersmith-0.0.3-py2-none-any.whl",
"has_sig": false,
"md5_digest": "d5c3c883c3d4948425af2d1ab062a197",
"packagetype": "bdist_wheel",
"python_version": "py2",
"requires_python": null,
"size": 27261,
"upload_time": "2018-10-03T06:04:43",
"url": "https://files.pythonhosted.org/packages/e3/4e/7f7a04d40a2bcfd0227496d906e9c5f8d1a53848d7101b15edd3d4c9e680/rastersmith-0.0.3-py2-none-any.whl"
},
{
"comment_text": "",
"digests": {
"md5": "2070c9f8e58e71fd273cef8608f928d9",
"sha256": "2d8a9ceee417bdaed236bd0cfcceacca13fb3eb74889a80a658d529f4b019855"
},
"downloads": -1,
"filename": "rastersmith-0.0.3.tar.gz",
"has_sig": false,
"md5_digest": "2070c9f8e58e71fd273cef8608f928d9",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 27777,
"upload_time": "2018-10-03T06:04:45",
"url": "https://files.pythonhosted.org/packages/5a/29/3115d82f357d72347a67380c4100de3e9beeb24536f13b83f8d9c7cb1370/rastersmith-0.0.3.tar.gz"
}
]
}