Skip to content
This repository has been archived by the owner on Dec 20, 2018. It is now read-only.

Add example netcdf file and R code #6

Open
vsimko opened this issue Mar 31, 2016 · 0 comments
Open

Add example netcdf file and R code #6

vsimko opened this issue Mar 31, 2016 · 0 comments
Assignees

Comments

@vsimko
Copy link
Member

vsimko commented Mar 31, 2016

This file from our server:
GT_SSD-L2-SEVIR_LST_2-20130725_120000-LIPM-0.05X0.05-V1.0.nc

And the R code, something like:

library(ncdf4)

# load the netcdf file to R
ncfile <- nc_open("path/to/the/nc/file")

# extract known layers
lst <- ncvar_get(ncfile, "LST")
lat <- ncvar_get(ncfile, "lat")
lon <- ncvar_get(ncfile, "lon")

# get the extremes
min(lst, na.rm = TRUE) - 273.15
max(lst, na.rm = TRUE) - 273.15

# show a very simple "heatmap"
image(lst)

image

# convert to a data frame
data <- data.frame(lat = as.vector(lat),
                   lon = as.vector(lon),
                   lst = as.vector(lst) - 273.15)
@vsimko vsimko self-assigned this Mar 31, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant