# Tag Info

3

106 years is exactly 12 * 106 = 1272 months, so that's the 1272. If it is in a sensible order (ie Jan 1901 to Dec 1901, then 1902, etc etc, a short formula can work out the numerical layer indices for a given year: year.layers = function(year){ start = 1 + (year - 1901)*12 start:(start+11) } Quick test, it should return numbers from 1 to 12 for 1901, ...

3

CRU is mm/month, ERA is m/day. So it depends on the number of days in the month. But for January you could divide CRU by 31000 or multiply ERA with 31000 Say you had an mean rainfall of 10 mm/day, ERA would report 0.01 and CRU would report 310 (for a month with 31 days). 310 / 31000 #[1] 0.01 0.01 * 31000 #[1] 310 As a function perhaps like this era_to_cru &...

2

No coding required. Zonal Statistics are designed to do this. Show your raster. Make sure you know what the map's projection is. If it's lat/long, you are working in degrees (like this example), otherwise metres/feet/etc for projected units. Set up a grid with Vector - Research Tools - Grid It can be rectangular, diamond or hexagonal. This will give you a ...

1

You should not use nc_open. Just do library(raster) tmp1 <- brick("cru_ts_3_00.1901.2006.tmp.nc", varname="tmp") Now subset start <- 12*(1960-1901) + 1 end <- start + 30 * 12 - 1 start #[1] 709 end #[1] 1068 tmp <- tmp1[[start:end]] But I would use terra like this (I am using a more recent version of the database): library(...

1

That seems to be a low level error from libtiff library. By the error message the libtiff function cannot read data from a certain part of the TIFF file. Directory here means the internal directory that TIFF file has and offset means the number of bytes from the beginning of the file. Either your copy of the TIFF file is corrupted or you have a different ...

1

This seems to work, just using gdal_calc.py: gdal_calc.py -A a1.tif --outfile=a3.tif --calc="(A<-9000)*65535 + (A>0)*A+8500" --NoDataValue=65535 --type=Int32 --overwrite converts to Int32 shifts the valid data up by 8500 shifts and sets the nodata value to 0xFFFF You might need to change the nodata test as my nodata value was -9999 but I ...

1

You need a GridCoverageFactory, some data and a bounding box to make what GeoTools calls a coverage. Once you have a coverage writing it out as a GeoTiff is easy. GridCoverageFactory gcf = new GridCoverageFactory(); CoordinateReferenceSystem crs = CRS.decode("EPSG:27700"); int llx = 500000; int lly = 105000; int urx = 501000; int ury = 106000; ...

1

Found it: Choose "Metada" (right click -> Metadata) Enter the no data value in Edit -> Set/Clear No Data Values -> Set no data (my case -9999) Enter the no data value in Edit -> Compute Pyramid Layers/Statiscs -> Ignore Value (my case -9999) and change to 1 in Max Skip Factor X/Y (because I use UTM and meters) Right click in 2D View ...

Only top voted, non community-wiki answers of a minimum length are eligible