{"id":18722638,"url":"https://github.com/mdsumner/fixoisst","last_synced_at":"2025-10-30T09:32:04.461Z","repository":{"id":72211410,"uuid":"469528119","full_name":"mdsumner/fixoisst","owner":"mdsumner","description":null,"archived":false,"fork":false,"pushed_at":"2022-08-24T00:35:12.000Z","size":1497,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-28T12:17:11.619Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mdsumner.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":"CODE_OF_CONDUCT.md","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}},"created_at":"2022-03-14T00:12:21.000Z","updated_at":"2022-08-13T12:38:58.000Z","dependencies_parsed_at":"2023-02-24T05:30:29.358Z","dependency_job_id":null,"html_url":"https://github.com/mdsumner/fixoisst","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdsumner%2Ffixoisst","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdsumner%2Ffixoisst/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdsumner%2Ffixoisst/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdsumner%2Ffixoisst/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mdsumner","download_url":"https://codeload.github.com/mdsumner/fixoisst/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239587244,"owners_count":19663892,"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":[],"created_at":"2024-11-07T13:42:17.201Z","updated_at":"2025-10-30T09:32:04.394Z","avatar_url":"https://github.com/mdsumner.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\"\n)\n```\n\n# fixoisst\n\n\u003c!-- badges: start --\u003e\n\u003c!-- badges: end --\u003e\n\nThe goal of fixoisst is to see what's required to add the grid_mapping scheme to OISST files. \n\nHere's an email sent to the maintainers 2022-03-14\n\n\n\u003e the OISST files have no \"grid_mapping\" variable, so downstream tools like GDAL miss auto-determining the coordinate system used by the sst, ice, anom, and err variables. \n\u003e\n\u003eI obtained an example file\n\u003e\n\u003ehttps://www.ncei.noaa.gov/data/sea-surface-temperature-optimum-interpolation/v2.1/access/avhrr/202202/oisst-avhrr-v02r01.20220218.nc\n\u003e\n\u003eand created a new \"file.nc\" that adds the scalar 'crs' var with attributes, and this is pointed to by new attributes 'coordinates' and 'grid_mapping' from the 4D variables that use 'lon' and 'lat'. \n\u003e\n\u003eI hope that future updates of the OISST files can include the 'grid_mapping' scheme. \n\u003e\n\u003eThank you. I've attached my example files and R script for your reference. \n\n\n## Implications for R \n\nWe wouldn't need to assign the projection this way with VRT or raster or whatever. \n\n```{r}\nvapour::vapour_raster_info(\"NETCDF:\\\"oisst-avhrr-v02r01.20220218.nc\\\":sst\")[c(\"projection\", \"projstring\")]\nvapour::vapour_raster_info(\"NETCDF:\\\"file.nc\\\":sst\")[c(\"projection\", \"projstring\")]\n```\n\nAs of this writing, {stars} doesn't get the projection from the original file (because GDAL doesn't), but {terra} and {raster} both do because of different heuristics (in terra) and different read facilities (in raster). I won't compare those other packages here because they change too and they aren't the point of this story (though this does have implications, for this one data set ...). \n\n## Comparison for GDAL \n\nHere we are missing the CRS, but with our additions in the second summary it correctly has the longitude/latitude projection stuff. Same goes for four variables 'sst', 'anom', 'err', and 'ice' which are 4D variables on a lonlat regular grid (with degenerate Z and time axes). \n\n\n(we hack-ily dump the Metadata chunk)\n\n\n```{r}\nsystem(\"gdalinfo NETCDF:\\\"oisst-avhrr-v02r01.20220218.nc\\\":sst\", intern = TRUE)[-c(6:67)]\n```\n\n\n```{r}\nsystem(\"gdalinfo NETCDF:\\\"file.nc\\\":sst\",intern = TRUE)[-c(24:91)]\n```\n\n## Original NetCDF \n\nHere's the NetCDF dump of the original file (which I used to email the maintainers). \n\n```{r}\nwriteLines(system(\"ncdump -h oisst-avhrr-v02r01.20220218.nc\", intern = TRUE))\n```\n\n## Modified NetCDF\n\nHere's the NetCDF dump of the modified file, with the modified section grep'ed out\n\n```{r}\nwriteLines(system(\"ncdump -h file.nc | grep \\\"short sst\\\" -A 45\", intern = TRUE))\n```\n\n---\n\n## Code of Conduct\n  \nPlease note that the fixoisst project is released with a [Contributor Code of Conduct](https://contributor-covenant.org/version/2/0/CODE_OF_CONDUCT.html). By contributing to this project, you agree to abide by its terms.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdsumner%2Ffixoisst","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmdsumner%2Ffixoisst","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdsumner%2Ffixoisst/lists"}