I have time series Global MODIS L3SMI dataset in ncdf format, how to subset this dataset on a specific location (i.e. Indonesia regions) based on longitude/latitude range. Then I want to write this dataset into ncdf file same as the original dataset without change anything on the ncdf structure (i.e. dimensions & variables names)
a sample dataset can be downloaded from this link https://oceandata.sci.gsfc.nasa.gov/cgi/getfile/A2018064.L3m_DAY_SST_sst_4km.nc
I have tried using transNcdfSubset
from ncdf.tools
package but give me error message:
Error in transNcdfSubset("A2018064.L3m_DAY_SST_sst_4km.nc", : Dimension names in file not latitude/longitude/time. Rename!
Here my code:
transNcdfSubset('A2018064.L3m_DAY_SST_sst_4km.nc',
dim.values = list(latitude = c(-25:20), longitude = c(90:145), rgb = c(), eightbitcolor=c()),
values.type = c("values", "values", "values", "values")[2],
file.output = sub("[.]nc", "_indo.nc", 'A2018064.L3m_DAY_SST_sst_4km.nc'),
var.name = readNcdfVarName('A2018064.L3m_DAY_SST_sst_4km.nc'))