{"id":17736671,"url":"https://github.com/parro-it/netcdf4","last_synced_at":"2025-04-30T22:12:01.219Z","repository":{"id":42234818,"uuid":"45586614","full_name":"parro-it/netcdf4","owner":"parro-it","description":"NodeJS addon to read and write NetCDF4 files","archived":false,"fork":false,"pushed_at":"2022-12-30T20:15:09.000Z","size":212,"stargazers_count":42,"open_issues_count":20,"forks_count":14,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-30T22:11:31.754Z","etag":null,"topics":["netcdf","netcdf4","nodejs","nodejs-addon"],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/parro-it.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}},"created_at":"2015-11-05T04:03:40.000Z","updated_at":"2025-01-12T08:04:56.000Z","dependencies_parsed_at":"2023-01-31T15:31:06.961Z","dependency_job_id":null,"html_url":"https://github.com/parro-it/netcdf4","commit_stats":null,"previous_names":["swillner/netcdf4-js"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parro-it%2Fnetcdf4","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parro-it%2Fnetcdf4/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parro-it%2Fnetcdf4/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parro-it%2Fnetcdf4/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/parro-it","download_url":"https://codeload.github.com/parro-it/netcdf4/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251789618,"owners_count":21644086,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["netcdf","netcdf4","nodejs","nodejs-addon"],"created_at":"2024-10-26T00:23:58.954Z","updated_at":"2025-04-30T22:12:01.170Z","avatar_url":"https://github.com/parro-it.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# netcdf4-js\n\n![Build status](https://github.com/parro-it/netcdf4/workflows/Node.js%20CI/badge.svg?branch=master)\n[![NPM Version](https://img.shields.io/npm/v/netcdf4.svg)](https://npmjs.org/package/netcdf4)\n\n\nNodeJS addon for reading and writing the files in the\n[Network Common Data Form (NetCDF)](https://www.unidata.ucar.edu/software/netcdf/)\nversion \u003c= 4,\nbuilt upon the C-library for netcdf.\n\n## Installation\n\n`netcdf4-js` is built with `nodejs` \u003e= 4.x\n\nInstall using `npm`:\n\n```\n$ npm install netcdf4\n```\n\nPrerequisites:\n\nYou will need `libnetcdf` \u003e= 4.x installed.\n\n### On Linux/Unix/OSX\n\n* Install NetCDF4 using your package manager, e.g., on Ubuntu/Debian:\n```\n$ sudo apt-get install libnetcdf-dev\n```\nor download it [here](https://www.unidata.ucar.edu/downloads/netcdf/index.jsp)\n* Make sure your system fulfills all the prerequisites of [node-gyp](https://github.com/nodejs/node-gyp#on-unix)\n\n### On Windows:\n\n* Install NetCDF4 from [here](https://www.unidata.ucar.edu/downloads/netcdf/index.jsp)\n* Make sure to select at least \"dependencies\", \"headers\" and \"libraries\" to install in the NetCDF installation wizard\n* Install the build tools as described [here](https://github.com/nodejs/node-gyp#on-windows)\n* Set the environment variable `NETCDF_DIR` to your NetCDF installation, e.g.,\n``` bash\nC:\\\u003e set NETCDF_DIR=C:\\Program Files\\netCDF 4.6.1\n```\n\n\n## Usage\n\nOpen files with\n```\nvar netcdf4 = require(\"netcdf4\");\n\nvar file = new netcdf4.File(\"test/testrh.nc\", \"r\");\n```\nFile modes are `\"r\"` for \"reading\", `\"w\"` for \"writing\", `\"c\"` for\n\"creation\", and `\"c!\"` for \"overwriting\".\n\nThen you can read variables using `read` or `readSlice`. The following example reads values at positions 5 to 15:\n```\nconsole.log(file.root.variables['var1'].readSlice(5, 10));\n```\n\n### Classes\n\nProperties marked *(r/w)* can be read and will be written to the file\nwhen set.\n\n#### File\n\nProperties:\n* `root` : Main `Group`-object in file\n\nMethods:\n* `close()` : Close file\n* `sync()` : Sync (or \"flush\") file to disk\n\n#### Group\n\nProperties:\n* `id` : ID used by C-library\n* `name` : Name\n* `fullname` : Full name (path in file)\n* `variables` : Associative array of variables in group\n* `dimensions` : Associative array of dimensions in group\n* `unlimited` : Associative array of unlimited Dimensions in group\n* `attribute` : Associative array of attributes of group\n* `subgroups` : Associative array of subgroups of group\n\nMethods:\n* `addVariable(name, type, dimensions)` : Add a new variable in\n  group. `type` is one of `\"byte\", \"char\", \"short\", \"int\", \"ubyte\", \"ushort\",\n  \"uint\", \"float\", \"double\"`. `dimensions` is an array of ids of dimensions\n  for the new variable. Returns new variable.\n* `addDimension(name, length)` : Add new dimension of length `length`\n  (can be `\"unlimited\"` for unlimited dimension). Returns new dimension.\n* `addSubgroup(name)` : Add subgroup. Returns new subgroup.\n* `addAttribute(name, type, value)` : Add and set new attribute. Returns new attribute.\n\n### Dimension\n\nProperties:\n* `id` : ID used by C-library\n* `name` : Name (r/w)\n* `length` : Length or currently used length for unlimited dimensions\n\n### Attribute\n\nProperties:\n* `id` : ID used by C-library\n* `name` : Name (r/w)\n* `value` : Value (r/w)\n\nMethods:\n* `delete()` : Delete attribute\n\n### Variable\n\nProperties:\n* `id` : ID used by C-library\n* `name` : Name (r/w)\n* `type` : Type of variable\n* `attributes` : Associative array of attributes\n* `dimensions` : Array of dimensions used by variable\n* `endianness` : Endianness: `\"little\"`, `\"big\"`, or `\"native\"` (r/w)\n* `checksummode` : Checksum mode: `\"none\"`, or `\"fletcher32\"` (r/w)\n* `chunkmode` : Chunk mode: `\"contiguous\"`, or `\"chunked\"` (r/w)\n* `chunksizes` : Array of chunk sizes (one size per dimension) (r/w)\n* `fillmode` : Boolean switch for fill mode (r/w)\n* `fillvalue` : Fill value (r/w)\n* `compressionshuffle` : Boolean switch for shuffle (r/w)\n* `compressiondeflate` : Boolean switch for compression (r/w)\n* `compressionlevel` : Compression level (1-9) (r/w)\n\nMethods:\n* `read(pos....)` : Reads and returns a single value at positions\n  given as for `write`.\n* `readSlice(pos, size....)` : Reads and returns an array of values (cf.\n  [\"Specify a Hyperslab\"](https://www.unidata.ucar.edu/software/netcdf/docs/programming_notes.html#specify_hyperslab))\n  at positions and sizes given for each dimension, `readSlice(pos1,\n  size1, pos2, size2, ...)` e.g. `readSlice(2, 3, 4, 2)` gives an\n  array of the values at position 2 for 3 steps along the first\n  dimension and position 4 for 2 steps along the second one.\n* `readStridedSlice(pos, size, stride....)` : Similar to `readSlice()`, but it\n  adds a *stride* (interval between indices) parameter to each dimension. If stride is 4,\n  the function will take 1 value, discard 3, take 1 again, etc.\n  So for instance `readStridedSlice(2, 3, 2, 4, 2, 1)` gives an\n  array of the values at position 2 for 3 steps with stride 2 (i.e.\n  every other value) along the first dimension and position 4 for 2 steps\n  with stride 1 (i.e. with no dropping) along the second dimension.\n* `write(pos..., value)` : Write `value` at positions given,\n  e.g. `write(2, 3, \"a\")` writes `\"a\"` at position 2 along the first\n  dimension and position 3 along the second one.\n* `writeSlice(pos, size..., valuearray)` : Write values in `valuearray`\n  (must be a typed array) at positions and sizes given for each\n  dimension, e.g. `writeSlice(2, 3, 4, 2, new\n  Int32Array([0, 1, 2, 3, 4, 5]))` writes the array at position 2 for\n  3 steps along the first dimension and position 4 for 2 step along\n  the second one (cf.\n  [\"Specify a Hyperslab\"](https://www.unidata.ucar.edu/software/netcdf/docs/programming_notes.html#specify_hyperslab)).\n* `writeStridedSlice(pos, size, stride..., valuearray)` : Similar to\n  `writeSlice()`, but it adds a *stride* parameter to each dimension.\n  So for instance `writeStridedSlice(2, 3, 2, 4, 2, 1), new\n  Int32Array([0, 1, 2, 3, 4, 5])` writes the array\n  at position 2 for 3 steps with stride 2 (i.e.\n  every other value) along the first dimension and position 4 for 2 steps\n  with stride 1 (i.e. with no dropping) along the second dimension.\n* `addAttribute(name, type, value)` : Adds and sets new attribute. Returns\n  new attribute.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparro-it%2Fnetcdf4","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fparro-it%2Fnetcdf4","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparro-it%2Fnetcdf4/lists"}