[R-sig-Geo] Fwd: TRMM data Analysis

H. Joe Lee hyok|ee @end|ng |rom hd|group@org
Fri Sep 2 17:19:55 CEST 2022


Hi,

  I wanted to look at the data but could not access it.
  I made a request.
  Please allow me to access the data to try your script on it.


- Joe
---
Build the Metaverse w/ HDF.



On Fri, Sep 2, 2022 at 4:34 AM sownal chand <sownalchandfms using gmail.com>
wrote:

>
> https://drive.google.com/file/d/1krtBKQUIhupvYKEG1gBV8bgQaQxx96pb/view?usp=drivesdk
>
>
> Attached is the link for the data
>
>
> ---------- Forwarded message ---------
> From: sownal chand <sownalchandfms using gmail.com>
> Date: Fri, Sep 2, 2022, 10:10
> Subject: TRMM data Analysis
> To: <r-sig-geo using r-project.org>
>
>
> Dear sir/madam
>
> I have a data set in NCDF file and was visualizing the data precipitation
> data set but ran into some small errors.
> The code is below:
> *******************************************************
> library(ncdf4)
>
> ncin <- nc_open("c:/Users/Downloads/PreNCDF.nc")
>
> #get longitutes and latitudes
>
> lon <<- ncvar_get(ncin,"lon")
>
> nlon <- dim(lon)
>
> lat <<- ncvar_get(ncin,"lat", verbose=F)
>
> nlat <- dim(lat)
>
> print(ncin)
> #get the time variable and attributes
>
> tori <<- ncvar_get(ncin,"TRMM_3B42RT_7_precipitation") #for time original
>
> tunits <<- ncatt_get(ncin,"TRMM_3B42RT_7_precipitation","units")
>
> nt <- dim(tori)
>
>
> View(nt)
> #get the variable and its attributes
>
> TRMM.array <<- ncvar_get(ncin,"TRMM_3B42RT_7_precipitation") #dimensions
> (lon,lat,time)
> print(TRMM.array)
>
> dim(TRMM.array)
>
> #m is the time slice you want to plot
>
> tmp.slice <- TRMM.array[, , 1]
>
> image(lon, lat, tmp.slice, col = rev(brewer.pal(10, "RdBu")))
>
> #betterway to plot
>
> TRMM.Precip <- tmp.array [, , m]  #note this is the same as above
>
> mapCDFtemp <- function(lat,lon,precip) #model and perc should be a string
>
> {
>
>   titletext <- "title"
>
>   expand.grid(lon, lat) %>%
>
>     rename(lon = Var1, lat = Var2) %>%
>
>     mutate(lon = ifelse(lon > 180, -(360 - lon), lon),
>
>            precip = as.vector(precip)) %>%
>
>     #mutate(tas = convert_precip(, "k", "c")) %>%
>
>
>
>     ggplot() +
>
>     geom_point(aes(x = lon, y = lat, color = precip),
>
>                size = 0.8) +
>
>     borders("world", colour="black", fill=NA) +
>
>     scale_color_viridis(na.value="white",name = "precip") +
>
>     theme(legend.direction="vertical", legend.position="right",
> legend.key.width=unit(0.4,"cm"), legend.key.heigh=unit(2,"cm")) +
>
>     coord_quickmap() +
>
>     ggtitle(titletext)
>
> }
>
>
> *******************************************
> Would really appreciate if it could be corrected and really appreciate your
> assistance
>
> thanking you in advance
> sownalc
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo using r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list