Assuming your three rasters have the same dimensions, you can use numpy's boolean indexing to accomplish this. First, you need to create three masks, each one corresponding to one of your conditions:
con1 = (dcl_array == 1) # raster a is 1
con2 = (dcl_array == 0) # raster a is 0
con3 = (tcd_array == 0) # raster c is 0
Then, you just have to index the ...
I would actually do this in reverse - create a raster from the vector provinces map, making sure you have aligned the rasters exactly, so each cell is associated with both a single province value and a single population density value.
Once you have accomplished this, you can run the GRASS program r.univar which will give you statistics by the province cells,...
I think dpi matters. I presume you did the export via Project > Import/Export > Export Map to Image...
wherein you can set the resolution (in dpi):
calculating the dpi theoretically necessary:
x * px/inch = px/m
x = (px/m) / (px/inch)
x = inch/m = 2.54cm / 100cm = 0.0254
So you would have to set the resolution to 0.0254 dpi.
Unfortunately at least in ...
You can start by defining your colors as a dictionary, mapping value to color. Then turn it into an array of colors, where the index is the value, filling non-existing value with some default color. Finally, turn this into a palette string. Remember to set your min and max value too.
I did some steps and with the help of @nmtoken I was able to fix it. I believe that my raster table had some problems maybe because I created it with complex geometries or maybe another reason. This time I changed the raster table I just simply used this codes in PostGIS to create a raster table from a single polygon:
SELECT ST_AsRaster(geom, 100, 100 , '...
Step 1: Go to https://search.earthdata.nasa.gov/search?q=SPL2SMAP_S
Step 2: Select the tile that pops up
Step 3: Filter granules by date and region
Step 4: Select + Add to Project on right
Step 5: Select My Project button that appears
Step 6: Select More Options
Step 7: Select Customize under Select Data Access Method
Step 8: Under Reformat Output select ...
Popsum should be the sum of all the pixels which fall within the vector polygon. In your case, if each pixel represents population density, it should equal the population. The values in that column very roughly match the population of the provinces according to Vietnamese census data, so it appears to have worked generally properly.
So here is a full outline of my solution. It seems that the xyz. tiles have an odd formatting since the coordinates are not in the expected order and have a positive N-S pixel resolution.
To fix the coordinates I first sorted the coordinates:
for file in *.xyz;
# sort coordinates
do sort -k2 -n -k1 "$file" -o "$file";
The positive N-S pixel ...
I would recommend a combination of geopandas and geocube.
Here is some untested set of code that should get you pretty close to what you want to do.
Step 1: Combine the shapefiles
gpd1 = geopandas.read_file("Shapefiles/shp1.shp")
gpd2 = geopandas.read_file("Shapefiles/shp2.shp")
gpd3 = geopandas.read_file("Shapefiles/shp3....
In QGIS 3.10.1 the developers put clipping of rasters in the Raster toolbar, in the Extraction section, it is now called "Clip Raster by Mask Layer". In the tool window there is an opportunity to select a CRS for input (or leave source CRS) and output rasters.
Definitely works with different CRS: I clipped a raster in Projected CRS with a mask layer in ...