Mapping with OCE

Data

Australian Bureau of Meteorology. 2008. GHRSST Level 4 GAMSSA Global Foundation Sea Surface Temperature Analysis. Ver. 1.0. PO.DAAC, CA, USA. Dataset accessed [YYYY-MM-DD] at https://doi.org/10.5067/GHGAM-4FA01. daTa downloaded from Group for High Resolution Sea Surface Temperature (GHRSST)
Data (link)[https://podaac.jpl.nasa.gov/dataset/NAVO-L4HR1m-GLOB-K10_SST]
comment:
start_date: 2019-12-08 UTC
start_time: 00:00:00 UTC
stop_date: 2019-12-09 UTC
stop_time: 00:00:00 UTC
southernmost_latitude: -80
northernmost_latitude: 80
westernmost_longitude: -180
easternmost_longitude: 180

Code

#load the libraries
library(ncdf4)
library(fields)
library(maps)
library(maptools)
library(mapproj)
library(mapdata)
library(scales)



#load data to the environment

nc <- nc_open("20191208-JPL_OUROCEAN-L4UHfnd-GLOB-v01-fv01_0-G1SST.nc")
print(nc,1)
## File 20191208-JPL_OUROCEAN-L4UHfnd-GLOB-v01-fv01_0-G1SST.nc (NC_FORMAT_CLASSIC):
## 
##      3 variables (excluding dimension variables):
##         short analysed_sst[lon,lat,time]   
##             _FillValue: -32768
##             add_offset: 273.149993896484
##             scale_factor: 0.00999999977648258
##             long_name: analysed sea surface temperature
##             standard_name: sea_surface_temperature
##             type: foundation
##             units: kelvin
##             valid_min: -900
##             valid_max: 4500
##         byte mask[lon,lat,time]   
##             long_name: sea/land/lake/ice field composite mask
##             _FillValue: -128
##             flag_values: 1b, 2b, 4b, 8b
##             flag_meanings: sea land lake ice
##             comment: b0: 1=grid cell is open sea water
## b1: 1=land is present in this grid cell
## b2: 1=lake surface is present in this grid cell
## b3: 1=sea ice is present in this grid cell
## b4-b7: reserved for future grid mask data
##         short analysis_error[lon,lat,time]   
##             _FillValue: -32768
##             add_offset: 273.149993896484
##             scale_factor: 0.00999999977648258
##             valid_min: 0
##             valid_max: 32767
##             long_name: estimated error standard deviation of analysed_sst
##             units: kelvin
## 
##      3 dimensions:
##         time  Size:1
##             units: seconds since 1981-01-01 00:00:00
##             long_name: reference time of sst field
##             standard_name: time
##             axis: T
##             calendar: Gregorian
##         lon  Size:36000
##             long_name: longitude
##             standard_name: longitude
##             axis: X
##             units: degrees_east
##         lat  Size:16000
##             long_name: latitude
##             standard_name: latitude
##             axis: Y
##             units: degrees_north
## 
##     23 global attributes:
##         Conventions: CF-1.0
##         title: G1SST, 1km blended SST
##         DSD_entry_id: JPL_OUROCEAN-L4UHfnd-GLOB-G1SST
##         references: A Blended Global 1-km Sea Surface Temperature Data Set for Research and Applications
## by Yi Chao, Benyang Tang, Zhijin Li, Peggy Li, Quoc Vu
##         institution: Jet Propulsion Laboratory, The OurOcean Team
##         contact: zhijin@jpl.nasa.gov, benyang.tang@jpl.nasa.gov
##         GDS_version_id: v1.0-rev1.7
##         netcdf_version_id: 3.6.0
##         creation_date: 2019-12-09 UTC
##         product_version: 1.0
##         history: 1km SST blended from 8 satellite observations
##         spatial_resolution: 1 km
##         source_data: AMSRE,AVHRR,TMI,MODIS,MODIS,GOES,METOP,MTSAT,SEVIRI,AATSR,in-situ
##         comment: 
##         start_date: 2019-12-08 UTC
##         start_time: 00:00:00 UTC
##         stop_date: 2019-12-09 UTC
##         stop_time: 00:00:00 UTC
##         southernmost_latitude: -80
##         northernmost_latitude: 80
##         westernmost_longitude: -180
##         easternmost_longitude: 180
##         file_quality_index: 0
#extract the variables
lon <- ncvar_get(nc,"lon")
lat <- ncvar_get(nc,"lat")

## cropping the Bay of Bengal region
lon_lim <- c(84,95)
lat_lim <- c(14,25)

lon_ind <- which(lon >= lon_lim[1] & lon <= lon_lim[2])
lat_ind <- which(lat >= lat_lim[1] & lat <= lat_lim[2])




sst <- ncvar_get(nc,"analysed_sst",start=c(lon_ind[1],lat_ind[1],1),count = c(length(lon_ind),length(lat_ind),-1))
dim(sst)
## [1] 1100 1100
#convert the unit from kelvin to degree c
sst <- sst-273.149993896484

##make a plot
par(mar=c(5, 4, 1, 1)+0.1)
image.plot(lon[lon_ind],lat[lat_ind], sst,legend.shrink = 0.5,legend.lab = "Temperature,∘C",xlab="Longitude(degrees east)",ylab="Latitude(degrees north)",main="2019-12-08 UTC",sub="Ocean surface temperatures in the BoB for 2019-12-08")
map("worldHires","Bangladesh", xlim=c(84,95),ylim=c(14,25), col="green", fill=TRUE,add = TRUE)
map("worldHires","India", xlim=c(84,95),ylim=c(14,25), col="dark grey", fill=TRUE, add=TRUE)
map("worldHires","Myanmar", xlim=c(84,95),ylim=c(14,25), col="grey90", fill=TRUE, add=TRUE)