[R-sig-Geo] make a raster from Aquarius files

Michael Sumner mdsumner at gmail.com
Fri Dec 1 12:24:50 CET 2017


That file name does not correspond to the standard patterns used by the
oceancolor site. All the L3m products from there are now (NetCDF 4.0) .nc
and so will work fine with raster/ncdf4.  (Some years ago they were HDF4 -
without an extension, as the shortcuts in the image thumbnails hints
(SMI/HDF and BIN/HDF - SMI/L3m standard mapped image in your case).

I think you've got some other provider's version of a file, but there's not
enough information here to know where you got it or what form it's in. I'm
happy to look if you can point us to the source of
Q20151522015181.L3m_MO_SCISM_V5.0_SSS_1deg.

But otherwise, can you share with us the output of

nc.data<-nc_open("Q20151522015181.L3m_MO_SCISM_V5.0_SSS_1deg")
print(nc.data)

and if you're on a suitable system with HDF4 support a gdalinfo output of
the file would be useful too.

Given that you can read it with ncdf4, and if it actually is NetCDF4 (not
HDF4 or something else) you might help raster work with it by renaming it
to "Q20151522015181.L3m_MO_SCISM_V5.0_SSS_1deg.nc" since (unlike GDAL and
the NetCDF lib itself) raster uses explicit extension to dispatch to
different format logic code, though it ultimately sends it down to rgdal to
deal with if it can't recognize it - which is why I'm surprised you can't
get it to work and ( I'm guessing wildly now):

Do you not have rgdal installed?


What system are you on? Please use sessionInfo() to share details.

Cheers, Mike.
On Fri, 1 Dec 2017, 06:14 Antonio Silva, <aolinto.lst at gmail.com> wrote:

> Hello
>
> Some time ago I prepared scripts to extract temperature data from Modis
> Aqua files. It can be found at https://gist.github.com/aolinto
>
> HDF files can be downloaded at https://oceancolor.gsfc.nasa.gov/cgi/l3
>
> I got the Aquarius sea surface salinity smoothed file from June 2015.
>
> I could open and read the file:
>
> library(ncdf4)
> library(raster)
>
> nc.data<-nc_open("Q20151522015181.L3m_MO_SCISM_V5.0_SSS_1deg")
> print(nc.data)
> dim(ncvar_get(nc.data,"l3m_data"))
> ncvar_get(nc.data,"l3m_data")[c(110:160),c(110:117)]
>
> But I could not prepare a raster from it. I tryed many things as:
>
> rst.data <-
> raster("Q20151522015181.L3m_MO_SCISM_V5.0_SSS_1deg",varname="l3m_data")
> Error in .local(.Object, ...) :
>   `AQUARIUS/Q20151522015181.L3m_MO_SCISM_V5.0_SSS_1deg' not recognised as a
> supported file format.
>
> Error in .rasterObjectFromFile(x, band = band, objecttype = "RasterLayer",
> :
>   Cannot create a RasterLayer object from this file.
>
> and variations with band and layer.
>
> I would greatly appreciate any suggestions to solve this issue.
>
> Thanks
>
> --
> Antônio Olinto Ávila da Silva
> Fisheries Institute
> São Paulo, Brasil
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo

-- 
Dr. Michael Sumner
Software and Database Engineer
Australian Antarctic Division
203 Channel Highway
Kingston Tasmania 7050 Australia

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list