{
"info": {
"author": "Kyle Wilcox",
"author_email": "kyle@axiomdatascience.com",
"bugtrack_url": null,
"classifiers": [
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: MIT License",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python",
"Topic :: Scientific/Engineering"
],
"description": "# pyncml [](https://travis-ci.org/axiom-data-science/pyncml)\n\n#### A simple python library to apply NcML logic to NetCDF files\n\n\n## Installation\n\n##### Stable\n\n```bash\n$ pip install pyncml\n# or\n$ conda install -c conda-forge pyncml\n```\n\n\n##### Development\n\n pip install git+https://github.com/axiom-data-science/pyncml.git\n\n\n## Supported\n\n* Adding things\n * Attributes: ``\n\n* Renaming things\n * Variables: ``\n * Attributes: ``\n * Dimensions: ``\n\n* Removing things\n * Variables: ``\n * Attributes: ``\n\n* Aggregating things\n * Scans: ``\n\n## Not supported\n\n* Adding variables (could be implemented in the future)\n* Groups (could be implemented in the future)\n* Setting actual data values on variables (could be implemented in the future)\n* Creating a file from scratch (could be implemented in the future)\n* Removing Dimensions (not implemented in the C library)\n* Aggregation scans that utilize the `dateFormatMark` attribute (most likely will never be implemented)\n\n## Usage\n\n### Apply\n\nThe `apply` function takes in a path to the `input_file` NetCDF file, an `ncml` object (string, file path, or python etree `Element` object), and an optional `output_file`. **If an output_file is not specified, the `input_file` will be edited in place**. The object returned from the `apply` function is a netcdf4-python object, ready to be used.\n\nAny `location` attributes in the NcML are **ignored** and the NcML is applied against the file specified as the `input_file`.\n\n##### Editing a file in place\n```python\nnetcdf = '/some/file/path/in.nc'\nncml = '/some/file/path/foo.ncml'\nimport pyncml\nnc = pyncml.apply(input_file=netcdf, ncml=ncml)\n```\n\n##### Using an NcML file\n```python\nnetcdf = '/some/file/path/in.nc'\nout = '/some/file/path/out.nc'\nncml = '/some/file/path/foo.ncml'\nimport pyncml\nnc = pyncml.apply(input_file=netcdf, ncml=ncml, output_file=out)\n```\n\n##### Using an NcML string\n```python\nnetcdf = '/some/file/path/in.nc'\nout = '/some/file/path/out.nc'\nncml = \"\"\"\n \n \n \n \n \n \n \"\"\"\nimport pyncml\nnc = pyncml.apply(input_file=netcdf, ncml=ncml, output_file=out)\n```\n\n##### Using an `etree` object\n```python\nimport pyncml\nnetcdf = '/some/file/path/in.nc'\nout = '/some/file/path/out.nc'\nncml = pyncml.etree.fromstring(\"\"\"\n \n \n \n \"\"\")\nnc = pyncml.apply(input_file=netcdf, ncml=ncml, output_file=out)\n```\n\n### Scan\n\nThe `scan` function takes in a path to an `ncml` object (string, file path, or python etree `Element` object).\n\n##### Results\n\nThe object returned from the `scan` function is a metadata object describing the scan aggregation **it is not a netcdf4-python object of the aggregation**. You can create a `netcdf4-python` object from the scan aggregation (example below).\n\n```python\nncml = '/some/file/path/foo.ncml'\nimport pyncml\nagg = pyncml.scan(ncml=ncml)\n\nprint(agg.starting)\n2014-06-20 00:00:00+00:00\n\nprint(agg.ending)\n2014-07-19 23:00:00+00:00\n\nprint(agg.timevar_name)\nu'time'\n\nprint(agg.standard_names)\n[\n u'time',\n u'projection_y_coordinate',\n u'projection_x_coordinate',\n u'eastward_wind_velocity'\n]\n\nprint(agg.members) # These are already sorted by the 'starting' date\n[\n {\n 'title': 'hello' # Pulled from the global attraibutes 'name' or 'title'\n 'starting': datetime.datetime(2014, 6, 20, 0, 0, tzinfo=),\n 'ending': datetime.datetime(2014, 6, 20, 0, 0, tzinfo=),\n 'path': '/path/to/aggregation/defined/in/ncml/first_member.nc'\n 'standard_names': [u'time',\n u'projection_y_coordinate',\n u'projection_x_coordinate',\n u'eastward_wind_velocity'],\n },\n {\n 'title': 'hello' # Pulled from the global attraibutes 'name' or 'title'\n 'starting': datetime.datetime(2014, 6, 20, 1, 0, tzinfo=),\n 'ending': datetime.datetime(2014, 6, 20, 1, 0, tzinfo=),\n 'path': '/path/to/aggregation/defined/in/ncml/second_member.nc'\n 'standard_names': [u'time',\n u'projection_y_coordinate',\n u'projection_x_coordinate',\n u'eastward_wind_velocity'],\n },\n ...\n]\n```\n\n##### Applying metadata\n\nBy default only the `scan` object in the `ncml` is used... meaning any attribute changes specified in the `ncml` **will not** be applied to individual members of the aggregation before computing the scan aggregation. If you would like each individual file to have the `ncml` applied to it (using the `apply` method documented above), set the `apply_to_members=True`. This will take longer because it is actually saving a new file with any applied `ncml` and then computing the metadata.\n\n```python\nncml = '/some/file/path/foo.ncml'\nimport pyncml\nagg = pyncml.scan(ncml=ncml, apply_to_members=True)\n```\n\n##### CPUs\n\n`scan` will utilize all cores minus 1 (`multiprocessing.cpu_count() - 1`). If you want to configure this setting use the `cpu_count=x` parameter to `scan`.\n\n```python\nncml = '/some/file/path/foo.ncml'\nimport pyncml\nagg = pyncml.scan(ncml=ncml, cpu_count=2)\n```\n\n\n\n##### Creating `netcdf4-python` Aggregation object\n\n**Note: This will not work with aggregations whose members overlap in time!**\n\n```python\nncml = '/some/file/path/foo.ncml'\nimport pyncml\nagg = pyncml.scan(ncml=ncml)\nfiles = [ f.path for f in agg.members ]\nagg = netCDF4.MFDataset(files)\ntime = agg.variables.get(agg.timevar_name)\n\nprint(time)\n\nfloat64 time('time',)\n long_name: date time\n units: hours since 1970-01-01 00:00:00\n _CoordinateAxisType: Time\nunlimited dimensions = ('time',)\ncurrent size = (14,)\n\nprint(time[:])\n[ 389784. 389785. 389786. 389787. 389788. 389789. 389790. 389791.\n 389792. 389793. 390500. 390501. 390502. 390503.]\n\nprint(netCDF4.num2date(time[:], units=time.units))\n[datetime.datetime(2014, 6, 20, 0, 0)\n datetime.datetime(2014, 6, 20, 1, 0)\n datetime.datetime(2014, 6, 20, 2, 0)\n datetime.datetime(2014, 6, 20, 3, 0)\n datetime.datetime(2014, 6, 20, 4, 0)\n datetime.datetime(2014, 6, 20, 5, 0)\n datetime.datetime(2014, 6, 20, 6, 0)\n datetime.datetime(2014, 6, 20, 7, 0)\n datetime.datetime(2014, 6, 20, 8, 0)\n datetime.datetime(2014, 6, 20, 9, 0)\n datetime.datetime(2014, 7, 19, 20, 0)\n datetime.datetime(2014, 7, 19, 21, 0)\n datetime.datetime(2014, 7, 19, 22, 0)\n datetime.datetime(2014, 7, 19, 23, 0)]\n```\n",
"description_content_type": null,
"docs_url": null,
"download_url": "",
"downloads": {
"last_day": -1,
"last_month": -1,
"last_week": -1
},
"home_page": "https://github.com/axiom-data-science/pyncml",
"keywords": "",
"license": "MIT",
"maintainer": "",
"maintainer_email": "",
"name": "pyncml",
"package_url": "https://pypi.org/project/pyncml/",
"platform": "",
"project_url": "https://pypi.org/project/pyncml/",
"project_urls": {
"Homepage": "https://github.com/axiom-data-science/pyncml"
},
"release_url": "https://pypi.org/project/pyncml/0.0.9/",
"requires_dist": null,
"requires_python": "",
"summary": "A simple python library to apply NcML logic to NetCDF files",
"version": "0.0.9"
},
"last_serial": 2876362,
"releases": {
"0.0.1": [
{
"comment_text": "",
"digests": {
"md5": "00be1c4e41bf1233bf7d448358478557",
"sha256": "c8093200179f9e2cda0ad129f01356c42db3e53c8e786b00d929c871c1b603b8"
},
"downloads": -1,
"filename": "pyncml-0.0.1.tar.gz",
"has_sig": false,
"md5_digest": "00be1c4e41bf1233bf7d448358478557",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 2261,
"upload_time": "2014-11-18T21:11:13",
"url": "https://files.pythonhosted.org/packages/37/09/c2ce874577bc8e71025db5f0b1f7da597662ea0cfd87e86279ecea578cdc/pyncml-0.0.1.tar.gz"
}
],
"0.0.2": [
{
"comment_text": "",
"digests": {
"md5": "5a1163e864d70d282dee66ad5e9d785b",
"sha256": "47dd845285c8bad0d895010a2f0364d1214d1df63c8b396f2ca62530882f0060"
},
"downloads": -1,
"filename": "pyncml-0.0.2.tar.gz",
"has_sig": false,
"md5_digest": "5a1163e864d70d282dee66ad5e9d785b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 2255,
"upload_time": "2014-11-18T21:14:45",
"url": "https://files.pythonhosted.org/packages/d0/9a/5327e527c7ddeaaa3720314c50a5638f2f2aba92b57f8e0593f829884c87/pyncml-0.0.2.tar.gz"
}
],
"0.0.3": [
{
"comment_text": "",
"digests": {
"md5": "70100e914410e9444cfed1ac9eb0bd7d",
"sha256": "c539fb35313a4a356929489f45d1255f55c7ae8b6a3d2b2f1cb3eb65bd337d9d"
},
"downloads": -1,
"filename": "pyncml-0.0.3.tar.gz",
"has_sig": false,
"md5_digest": "70100e914410e9444cfed1ac9eb0bd7d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 3330,
"upload_time": "2014-11-18T21:20:41",
"url": "https://files.pythonhosted.org/packages/89/2e/2ae4b1627fc05876859ac4c6958f6d7ebcde1c9944fe63312173507f288e/pyncml-0.0.3.tar.gz"
}
],
"0.0.4": [
{
"comment_text": "",
"digests": {
"md5": "f2623cbfc8387db7253d5620ea353e9f",
"sha256": "9ad0405eeccdc4952d69670dcbb1dd9c2bec193b178819f0611df4e6be643d6f"
},
"downloads": -1,
"filename": "pyncml-0.0.4.tar.gz",
"has_sig": false,
"md5_digest": "f2623cbfc8387db7253d5620ea353e9f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 4447,
"upload_time": "2014-12-15T16:12:46",
"url": "https://files.pythonhosted.org/packages/d0/3e/54ecc8b2403d0f8c9069e4feaa8516ac4cc70d332264a8524d47e4895cda/pyncml-0.0.4.tar.gz"
}
],
"0.0.5": [
{
"comment_text": "",
"digests": {
"md5": "201bfca87a37a9de4ce471886fc8bbab",
"sha256": "1f2ee98f2405b63ae2eea399076fdf426621662e8f93d680fd0b2d2bac7602ea"
},
"downloads": -1,
"filename": "pyncml-0.0.5.tar.gz",
"has_sig": false,
"md5_digest": "201bfca87a37a9de4ce471886fc8bbab",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 8815,
"upload_time": "2014-12-15T19:09:19",
"url": "https://files.pythonhosted.org/packages/c9/b8/16e77fe535534ded05d32e823107b9b49fb959df3c28a4292a1275a2fa97/pyncml-0.0.5.tar.gz"
}
],
"0.0.6": [
{
"comment_text": "",
"digests": {
"md5": "34b639f2f068e38f3c01fe58261efbb7",
"sha256": "fd32fec5d1eac6a657a0930b06b192b65ad5afb1436ee2b27000e443d9b3b2da"
},
"downloads": -1,
"filename": "pyncml-0.0.6.tar.gz",
"has_sig": false,
"md5_digest": "34b639f2f068e38f3c01fe58261efbb7",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 9014,
"upload_time": "2014-12-15T19:24:52",
"url": "https://files.pythonhosted.org/packages/86/ba/d244c31e9f3d8021c6b3acb141d5d1cef6cd66e1a8ffab32cabf555aa246/pyncml-0.0.6.tar.gz"
}
],
"0.0.7": [
{
"comment_text": "",
"digests": {
"md5": "964af7ee7a05a6dc5993a280e3ec5eb4",
"sha256": "f481c97506917bc1ec750833b7659969d7cfae2abc9c5b3734232e88ab12e705"
},
"downloads": -1,
"filename": "pyncml-0.0.7.tar.gz",
"has_sig": false,
"md5_digest": "964af7ee7a05a6dc5993a280e3ec5eb4",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 9156,
"upload_time": "2015-03-17T15:35:57",
"url": "https://files.pythonhosted.org/packages/77/92/fe0db5b8e0fc87e06d1a2536002e990fe652f7b537ff284d484eb71a4d99/pyncml-0.0.7.tar.gz"
}
],
"0.0.8": [
{
"comment_text": "",
"digests": {
"md5": "4a77f97a687561fde285f7fad1c297e2",
"sha256": "85a17f924f8b7713be7cd508513bf0bec8175fe59dca96f008c16e8406d8a926"
},
"downloads": -1,
"filename": "pyncml-0.0.8.tar.gz",
"has_sig": false,
"md5_digest": "4a77f97a687561fde285f7fad1c297e2",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 9007,
"upload_time": "2015-07-28T21:48:00",
"url": "https://files.pythonhosted.org/packages/5e/6d/057295ed9dac894cf673cbe8893cf70488c50bd7719afb4ffef09dcacc0f/pyncml-0.0.8.tar.gz"
}
],
"0.0.9": [
{
"comment_text": "",
"digests": {
"md5": "e51ee01eadcbfee514b6cf83187e5564",
"sha256": "f0df2ab0644e0f0923794db74cd55a23999f8c2889153bcdcd96ca27aeff4fac"
},
"downloads": -1,
"filename": "pyncml-0.0.9.tar.gz",
"has_sig": false,
"md5_digest": "e51ee01eadcbfee514b6cf83187e5564",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 8321,
"upload_time": "2017-05-15T19:48:17",
"url": "https://files.pythonhosted.org/packages/76/98/d7976337d5750c86dac75064eee51356b9968bc42299b7346f3d25b6ee45/pyncml-0.0.9.tar.gz"
}
]
},
"urls": [
{
"comment_text": "",
"digests": {
"md5": "e51ee01eadcbfee514b6cf83187e5564",
"sha256": "f0df2ab0644e0f0923794db74cd55a23999f8c2889153bcdcd96ca27aeff4fac"
},
"downloads": -1,
"filename": "pyncml-0.0.9.tar.gz",
"has_sig": false,
"md5_digest": "e51ee01eadcbfee514b6cf83187e5564",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 8321,
"upload_time": "2017-05-15T19:48:17",
"url": "https://files.pythonhosted.org/packages/76/98/d7976337d5750c86dac75064eee51356b9968bc42299b7346f3d25b6ee45/pyncml-0.0.9.tar.gz"
}
]
}