Timeline for Extract time series subset from NetCDF for many spatial points using R
Current License: CC BY-SA 4.0
13 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
May 17 at 15:34 | comment | added | user2955884 | Where is the syntax "macav2metdata_tasmax_bcc-csm1-1_r1i1p1_rcp85_2036_2040_CONUS_daily.nc?&var=air_temperature&north=47.6200&south=45.9300&west=-121.6100&east=-119.0900&temporal=all&accept=netcdf&point=false" documented? | |
Mar 7 at 18:12 | comment | added | Hailey | Here is my code to load the nc files and apply the function: maxtemp.nc <- function(ncname) { NCF <- raster(ncname) nc.all <- NCF[[idx]] alldates <- extract(nc.all, predptsWGS) alldates.pts <- cbind(predptsWGS, alldates[,-1]) csvfile <- paste0(ncname, ".csv") write.csv(alldates.pts, csvfile) } allnc.files <- list.files("/Users/.../Desktop/NetCDF/MaxAirTempData") lapply(allnc.files, maxtemp.nc) This gives the same error as above. | |
Mar 7 at 17:53 | comment | added | Hailey | Do you have any suggestions for getting lapply to load the .nc files? All other suggestions I've read (for example, stackoverflow.com/questions/9564489/… is very close to what I need to do) show lapply reading in many .csv files, but won't work for .nc. For example, the function lapply(nc.files, raster) gives the error: Error in (function (classes, fdef, mtable):unable to find an inherited method for function ‘trim’ for signature ‘"character". | |
Mar 7 at 13:06 | comment | added | Jeffrey Evans | @Hailey since we created dates by day, the resulting indices and raster subset are daily. | |
Mar 6 at 23:27 | comment | added | Hailey | One more question. If I index by week, does the resulting value represent the first day of that week, or an average of all days in the week? Thanks again for your help. | |
Mar 6 at 23:24 | comment | added | Hailey | Your explanation is wonderful, thank you so much! I've managed to apply everything except for making this work for a group of netCDF files. I've tried using for and lapply, but can only seem to achieve loading a vector with the character names of my .nc files and am not sure how to proceed. Here is my current R script: drive.google.com/file/d/1WJNY7x8GpuVAvVjozkxLDvGDyVw0ZzMY/… and here is the PredPtsWGS.csv file: drive.google.com/file/d/1Hykk432klHTpKMKdf2v2SW4QzwPV9GKu/… | |
Mar 6 at 14:20 | history | edited | Jeffrey Evans | CC BY-SA 4.0 |
Fixed typo
|
Mar 6 at 0:24 | vote | accept | Hailey | ||
Mar 5 at 21:47 | history | edited | Jeffrey Evans | CC BY-SA 4.0 |
added 4 characters in body
|
Mar 5 at 21:24 | history | edited | Jeffrey Evans | CC BY-SA 4.0 |
added 129 characters in body
|
Mar 5 at 21:16 | history | edited | Jeffrey Evans | CC BY-SA 4.0 |
added 1955 characters in body
|
Mar 5 at 21:11 | history | edited | Jeffrey Evans | CC BY-SA 4.0 |
added 1955 characters in body
|
Mar 5 at 20:20 | history | answered | Jeffrey Evans | CC BY-SA 4.0 |