{"id":37063232,"url":"https://github.com/cemc-oper/reki","last_synced_at":"2026-01-14T07:03:48.261Z","repository":{"id":57460957,"uuid":"248670615","full_name":"cemc-oper/reki","owner":"cemc-oper","description":"A data preparation tool in CEMC/CMA.","archived":false,"fork":false,"pushed_at":"2025-08-22T04:01:52.000Z","size":693,"stargazers_count":18,"open_issues_count":2,"forks_count":7,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-24T23:16:24.671Z","etag":null,"topics":["cedarkit","data-processing","grib2"],"latest_commit_sha":null,"homepage":"https://reki.readthedocs.io/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cemc-oper.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-03-20T04:50:19.000Z","updated_at":"2025-08-22T04:01:56.000Z","dependencies_parsed_at":"2023-11-25T12:28:19.750Z","dependency_job_id":"09090264-bbc2-461b-a0ba-017332bc930c","html_url":"https://github.com/cemc-oper/reki","commit_stats":null,"previous_names":["nwpc-oper/reki"],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/cemc-oper/reki","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cemc-oper%2Freki","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cemc-oper%2Freki/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cemc-oper%2Freki/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cemc-oper%2Freki/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cemc-oper","download_url":"https://codeload.github.com/cemc-oper/reki/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cemc-oper%2Freki/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28412495,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T05:26:33.345Z","status":"ssl_error","status_checked_at":"2026-01-14T05:21:57.251Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cedarkit","data-processing","grib2"],"created_at":"2026-01-14T07:03:47.568Z","updated_at":"2026-01-14T07:03:48.255Z","avatar_url":"https://github.com/cemc-oper.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# reki\n\n![GitHub Release](https://img.shields.io/github/v/release/cemc-oper/reki)\n![PyPI - Version](https://img.shields.io/pypi/v/reki)\n[![Documentation Status](https://readthedocs.org/projects/reki/badge/?version=latest)](https://reki.readthedocs.io/zh_CN/latest/?badge=latest)\n![GitHub License](https://img.shields.io/github/license/cemc-oper/cedarkit-maps)\n![GitHub Action Workflow Status](https://github.com/cemc-oper/reki/actions/workflows/ci.yaml/badge.svg)\n\nA data preparation tool for meteorological data in CEMC/CMA.\n\nLoad GRIB2 data using [eccodes](https://github.com/ecmwf/eccodes-python)\nor [cfgrib](https://github.com/ecmwf/cfgrib).\n\n中文文档 (Chinese documentation): https://reki.readthedocs.io/\n\n## Installation\n\nInstall from pip:\n\n```bash\npip install reki\n```\n\nor download the latest source code from GitHub and install using `pip`.\n\n`reki` uses ecCodes to decode GRIB files\n(which is needed by [eccodes](https://github.com/ecmwf/eccodes-python) and [cfgrib](https://github.com/ecmwf/cfgrib)). \nPlease install ecCodes through conda or other package source.\n\n## Getting started\n\n### Local file lookup\n\nThe reki library includes built-in config files to locate data files in the CMA National Meteorological Supercomputing System 1 (CMA-HPC2023-SC1) shared file system (`/g3/COMMONDATA`).\nThe codes below finds the GRIB2-ORIG file path for CMA-GFS:\n\n```pycon\n\u003e\u003e\u003e from reki.data_finder import find_local_file\n\u003e\u003e\u003e gfs_grib2_file_path = find_local_file(\n...     \"cma_gfs_gmf/grib2/orig\",\n...     start_time=\"2025081900\",\n...     forecast_time=\"24h\",\n... )\n\u003e\u003e\u003e gfs_grib2_file_path\nPosixPath('/g3/COMMONDATA/OPER/CEMC/GFS_GMF/Prod-grib/2025081900/ORIG/gmf.gra.2025081900024.grb2')\n```\n\nThe `find_local_file` function supports additional parameters for more specific file selection. \nFor instance, using number to indicate ensemble member:\n\n```pycon\n\u003e\u003e\u003e geps_grib2_file_path = find_local_file(\n...     \"cma_geps/grib2/orig\",\n...     start_time=\"2025081900\",\n...     forecast_time=\"24h\",\n...     number=2,\n... )\n\u003e\u003e\u003e geps_grib2_file_path\nPosixPath('/g3/COMMONDATA/OPER/CEMC/GEPS/Prod-grib/2025081900/grib2/gef.gra.002.2025081900024.grb2')\n```\n\nreki also supports locating intermediate model output files. \nThe example below find path of the 240-hour model-level binary data file for CMA-GFS:\n\n```pycon\n\u003e\u003e\u003e gfs_modelvar_file_path = find_local_file(\n...     \"cma_gfs_gmf/bin/modelvar\",\n...     start_time=\"2025081900\",\n...     forecast_time=\"240h\",\n... )\n\u003e\u003e\u003e gfs_modelvar_file_path\nPosixPath('/g3/COMMONDATA/OPER/CEMC/GFS_GMF/Fcst-long/2025081900/modelvar2025081900_240')\n```\n\nBuilt-in configuration files are located in the `reki/data_finder/conf` directory.\n\n### Reading GRIB2 files\n\n#### Basic method\n\nUse **eccodes** to retrieve a field from a GRIB2 file and return an `xarray.DataArray` object.\nThis example loads the 850 hPa temperature field from a CMA-GFS GRIB2-ORIG data:\n\n```pycon\n\u003e\u003e\u003e from reki.format.grib.eccodes import load_field_from_file\n\u003e\u003e\u003e field = load_field_from_file(\n...     gfs_grib2_file_path,\n...     parameter=\"t\",\n...     level_type=\"pl\",\n...     level=850,\n... )\n\u003e\u003e\u003e field\n\u003cxarray.DataArray 't' (latitude: 1440, longitude: 2880)\u003e Size: 33MB\narray([[270.49505859, 270.50505859, 270.50505859, ..., 270.49505859,\n        270.49505859, 270.49505859],\n       [270.69505859, 270.70505859, 270.71505859, ..., 270.70505859,\n        270.70505859, 270.69505859],\n       [270.84505859, 270.85505859, 270.85505859, ..., 270.84505859,\n        270.84505859, 270.84505859],\n       ...,\n       [247.60505859, 247.58505859, 247.74505859, ..., 247.62505859,\n        247.63505859, 247.61505859],\n       [247.26505859, 247.26505859, 247.25505859, ..., 247.25505859,\n        247.25505859, 247.25505859],\n       [246.84505859, 246.84505859, 246.84505859, ..., 246.85505859,\n        246.84505859, 246.84505859]], shape=(1440, 2880))\nCoordinates:\n    time        datetime64[ns] 8B 2025-08-19\n    step        timedelta64[ns] 8B 1 days\n    valid_time  datetime64[ns] 8B 2025-08-20\n    pl          float64 8B 850.0\n  * latitude    (latitude) float64 12kB 89.94 89.81 89.69 ... -89.81 -89.94\n  * longitude   (longitude) float64 23kB 0.0 0.125 0.25 ... 359.6 359.8 359.9\nAttributes: (12/17)\n    GRIB_edition:             2\n    GRIB_centre:              babj\n    GRIB_subCentre:           0\n    GRIB_tablesVersion:       4\n    GRIB_localTablesVersion:  0\n    GRIB_dataType:            fc\n    ...                       ...\n    GRIB_stepType:            instant\n    GRIB_stepUnits:           1\n    GRIB_stepRange:           24\n    GRIB_endStep:int:         24\n    GRIB_count:               109\n    long_name:                discipline=0 parmcat=0 parm=0\n```\n\nQuick plotting:\n\n```pycon\n\u003e\u003e\u003e (field - 273.15).plot()\n```\n\n#### Level Type\n\nLoad variables from model-level data. \nThe example below loads the u-component at model level 10 (`ml`) from CMA-GFS model-level GRIB2 data:\n\n```pycon\n\u003e\u003e\u003e gfs_model_grib2_file_path = find_local_file(\n...     \"cma_gfs_gmf/grib2/modelvar\",\n...     start_time=\"2025081900\",\n...     forecast_time=\"24h\",\n... )\n\u003e\u003e\u003e gfs_model_grib2_file_path\nPosixPath('/g3/COMMONDATA/OPER/CEMC/GFS_GMF/Prod-grib/2025081900/MODELVAR/modelvar2025081900024.grb2')\n\u003e\u003e\u003e field = load_field_from_file(\n...     gfs_model_grib2_file_path,\n...     parameter=\"u\",\n...     level_type=\"ml\",\n...     level=10,\n... )\n\u003e\u003e\u003e field\n\u003cxarray.DataArray 'u' (latitude: 1440, longitude: 2880)\u003e Size: 33MB\narray([[ 9.09106934,  9.09106934,  9.10106934, ...,  9.09106934,\n         9.09106934,  9.09106934],\n       [ 8.00106934,  8.00106934,  8.00106934, ...,  8.01106934,\n         8.01106934,  8.01106934],\n       [ 7.97106934,  7.96106934,  7.96106934, ...,  7.97106934,\n         7.97106934,  7.97106934],\n       ...,\n       [11.00106934, 10.99106934, 10.98106934, ..., 11.04106934,\n        11.03106934, 11.01106934],\n       [11.73106934, 11.72106934, 11.71106934, ..., 11.77106934,\n        11.75106934, 11.74106934],\n       [14.21106934, 14.20106934, 14.19106934, ..., 14.24106934,\n        14.23106934, 14.22106934]], shape=(1440, 2880))\nCoordinates:\n    time        datetime64[ns] 8B 2025-08-19\n    step        timedelta64[ns] 8B 1 days\n    valid_time  datetime64[ns] 8B 2025-08-20\n    ml          int64 8B 10\n  * latitude    (latitude) float64 12kB 89.94 89.81 89.69 ... -89.81 -89.94\n  * longitude   (longitude) float64 23kB 0.0 0.125 0.25 ... 359.6 359.8 359.9\nAttributes: (12/17)\n    GRIB_edition:             2\n    GRIB_centre:              babj\n    GRIB_subCentre:           0\n    GRIB_tablesVersion:       4\n    GRIB_localTablesVersion:  0\n    GRIB_dataType:            fc\n    ...                       ...\n    GRIB_stepType:            instant\n    GRIB_stepUnits:           1\n    GRIB_stepRange:           24\n    GRIB_endStep:int:         24\n    GRIB_count:               187\n    long_name:                discipline=0 parmcat=2 parm=2\n```\n\n#### More filtering options\n\nThe `load_field_from_file` function also supports passing GRIB key parameters directly via a dictionary.\nThe example below loads the radar reflectivity field at 850 hPa:\n\n```pycon\n\u003e\u003e\u003e field = load_field_from_file(\n...     gfs_grib2_file_path,\n...     parameter={\n...         \"discipline\": 0,\n...         \"parameterCategory\": 16,\n...         \"parameterNumber\": 225,\n...     },\n...     level_type=\"pl\",\n...     level=850,\n... )\n\u003e\u003e\u003e field\n\u003cxarray.DataArray '0_16_225' (latitude: 1440, longitude: 2880)\u003e Size: 33MB\narray([[-7.12, -7.17, -7.24, ..., -7.03, -7.04, -7.06],\n       [-7.71, -7.64, -7.65, ..., -7.82, -7.8 , -7.78],\n       [-6.03, -6.07, -6.08, ..., -6.07, -6.08, -6.08],\n       ...,\n       [ 1.52,  1.37,  1.18, ...,  1.59,  1.22,  1.23],\n       [ 0.65,  0.68,  1.31, ...,  0.65,  0.67,  0.69],\n       [-0.22, -0.2 , -0.21, ..., -0.25, -0.24, -0.24]],\n      shape=(1440, 2880))\nCoordinates:\n    time        datetime64[ns] 8B 2025-08-19\n    step        timedelta64[ns] 8B 1 days\n    valid_time  datetime64[ns] 8B 2025-08-20\n    pl          float64 8B 850.0\n  * latitude    (latitude) float64 12kB 89.94 89.81 89.69 ... -89.81 -89.94\n  * longitude   (longitude) float64 23kB 0.0 0.125 0.25 ... 359.6 359.8 359.9\nAttributes: (12/17)\n    GRIB_edition:             2\n    GRIB_centre:              babj\n    GRIB_subCentre:           0\n    GRIB_tablesVersion:       4\n    GRIB_localTablesVersion:  1\n    GRIB_dataType:            fc\n    ...                       ...\n    GRIB_stepType:            instant\n    GRIB_stepUnits:           1\n    GRIB_stepRange:           24\n    GRIB_endStep:int:         24\n    GRIB_count:               790\n    long_name:                discipline=0 parmcat=16 parm=225\n```\n\n#### ecCodes interface\n\nreki supports returning the raw GRIB message via the ecCodes Python API.\nFor instance, loading the 850 hPa geopotential height field:\n\n```pycon\n\u003e\u003e\u003e from reki.format.grib.eccodes import load_message_from_file\n\u003e\u003e\u003e message = load_message_from_file(\n...     gfs_grib2_file_path,\n...     parameter=\"gh\",\n...     level_type=\"pl\",\n...     level=850,\n... )\n\u003e\u003e\u003e message\n94257262686816\n\u003e\u003e\u003e import eccodes\n\u003e\u003e\u003e values = eccodes.codes_get_double_array(message, \"values\")\n\u003e\u003e\u003e ni = eccodes.codes_get_long(message, \"Ni\")\n\u003e\u003e\u003e nj = eccodes.codes_get_long(message, \"Nj\")\n\u003e\u003e\u003e values.reshape(nj, ni)\narray([[1425.48203125, 1425.48203125, 1425.48203125, ..., 1425.48203125,\n        1425.48203125, 1425.48203125],\n       [1428.68203125, 1428.68203125, 1428.68203125, ..., 1428.68203125,\n        1428.68203125, 1428.68203125],\n       [1431.18203125, 1431.18203125, 1431.18203125, ..., 1431.18203125,\n        1431.18203125, 1431.18203125],\n       ...,\n       [1311.18203125, 1311.28203125, 1310.38203125, ..., 1311.08203125,\n        1311.08203125, 1311.08203125],\n       [1311.88203125, 1311.78203125, 1311.88203125, ..., 1311.88203125,\n        1311.88203125, 1311.88203125],\n       [1313.38203125, 1313.38203125, 1313.38203125, ..., 1313.28203125,\n        1313.38203125, 1313.38203125]], shape=(1440, 2880))\n```\n\nFinally, release the GRIB message object:\n\n```pycon\n\u003e\u003e\u003e eccodes.codes_release(message)\n```\n\n## Examples\n\nSee [cemc-oper/data-notebook](https://github.com/cemc-oper/data-notebook) project for more examples.\n\n## LICENSE\n\nCopyright \u0026copy; 2020-2025, developers at cemc-oper.\n\n`reki` is licensed under [Apache License, Version 2.0](./LICENSE)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcemc-oper%2Freki","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcemc-oper%2Freki","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcemc-oper%2Freki/lists"}