1

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'))
Eko Susilo
  • 250
  • 2
  • 15
  • I think you might got the attribute names wrong. Try this to see the metadata from that file: `library(ncdf4); nc <- nc_open('A2018064.L3m_DAY_SST_sst_4km.nc'); print(nc)` – Tung Jul 20 '18 at 04:24
  • This might help [netCDF in R](http://geog.uoregon.edu/bartlein/courses/geog490/week04-netCDF.html) – Tung Jul 20 '18 at 04:25
  • I have done this step. I know that the variables names are not appropriate with this `transNcdfSubset`. This is the first issue that my concern is to have the subset data with the original ncdf structure. The second issue is my data have 4 dimensions (lat/lon/rgb/eightbitcolor) and `transNcdfSubset` only give 3 arguments on 'dim.values' (latitude/longitude/time). My dataset also doesn't have `time` dimensions, this daily based data – Eko Susilo Jul 20 '18 at 08:54

0 Answers0