This is a bunch of R codes created by Yinan Feng
Including:
- Calculate the pixel size
- Insert the missing values of GRACE data
This is a R function to calculat the relatively accurate area of a raster data at degree resolution.
The bsic idea and explaination are orignated from whuber's answer in StackExchange
StackExchange:more accurate way to calculate area of rasters
Calculate m^2 area of a wgs84 square pixel.
May available in other CRSs by defining the right "a" and "b"
Parameters:
pixel_size (float): length of side of pixel in degrees.
center_lat (float): latitude of the center of the pixel. Note this
value +/- half the pixel-size
must not exceed 90/-90 degrees
latitude or an invalid area will be calculated.
Returns:
Area of square pixel of side length pixel_size
centered at
center_lat
in m^2
"mosaic" package needed
For users haven't download package "mosaic",
please download the package by run following code in console :
'install.packages("mosaic")'
This is a R code to insert the missing value of GRACE data The GRACE gravity satellite data have many missing values due to the regular battery maintenance schedule. To reduce the bias caused by direct insertion of the average values, I use monthly averages for interpolation.
-Comparing the data's time sequence with complete time sequence
-Calcaulate the monthly mean of GRACE data
-According the missing date, interst the monthly acerage of the corresponding month