This metadata should be in the NetCDF - check all the dimensions for info, you might even find the actual coordinates in a dimension. ![]() I use 85 here because Mercator maps don't go up to 90 - I'm not sure what yours is but I don't want you to blindly stick "90" in there!Īlso if your data is 0 latitude on the left and right with 180 in the middle (or some other shift) then the rotate function in the raster package can unwrap that for you.Īlso you do have to be certain the map is in a regular lat-long coordinate system and not in some projection where the cell sizes change in degrees as you go N and S. Here's a raster on the unit square: > r = raster(matrix(1:100,10,10))ĭimensions : 10, 10, 100 (nrow, ncol, ncell)Įxtent : 0, 1, 0, 1 (xmin, xmax, ymin, ymax)Īnd if I've read that from a source that didn't have the correct coordinates, and I know its a degree coordinate system over the globe up to 85 degrees north and south, then it should be correctly geo-referenced by: > extent(r) = c(-180,180,-85,85)Įxtent : -180, 180, -85, 85 (xmin, xmax, ymin, ymax) If you know the extent that your raster data should be then you can replace the current extent with a new extent. I would like them to be on a -180-180 scale so that I'm able to plot with world boundaries and crop the extents in ggplot2 (or outside of ggplot). However, when I plot it (without the borders and coord_sf arguments) the scale for the x and y axes are from 0-1. #scale_fill_gradientn(colours = rev(lors(225))) + ![]() #borders("world", colour = "black", fill = NA) + Scale_fill_viridis(na.value = "white", name = "Anomaly (°C)") + I have temperature anomaly arrays for the months of February 2008-2021 that I have turned into a raster brick.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |