Tag Info

New answers tagged

0

If you're familiar with Python you can use the netCDF4-python library that can read and write both netCDF 3 and 4 data to numpy arrays. For example: from netCDF4 import Dataset root_group = Dataset("path_to_dataset", format='NETCDF4') print root_group $ netCDF4 style dump data = root_group.variables["some_variable"][:] Python has a large number of ...


0

To answer the first part of your question, you need to use the == equality operator rather than =. Your list of DEMs also includes the extension, so you will need handle that. For example, using the == operator, this is the syntax you would need to use: # Sample list of DEMs dems = ["test1.tif", "test2.tif", "bethel_filled.tif"] for dem in dems: if ...


0

The easier way to use the Clip Tool in QGIS is by using the "extent clipping mode". For example, I want to clip the area represented by the shapefile in the next image: With Raster -> Extraction -> Clipper, put the output name raster and select its area by drag on shapefile area. Then, click on Ok. At the layer properties of the clipped raster you ...


4

In this test raster (20x20), with values between 1 and 50, I replaced 19 value by -32768 value. In the following raster, the -32768 values were replaced by -3.40282e+38 values (see window of Value Tool Plugin): The used expression is in the window of "Raster calculator expression" (below image and code sample): ...


0

It worked out that I can't re project on the fly as I am mosaicing all the raster Files. I had to first mosaic them and once that was done - only then could I re project it. Interesting.


1

whuber showed the way, but here's another way to get there (using the functions that match the operations he suggests) d <- c(.25,.50,.75) m <- cbind(1:3, d) r3 <- reclassify(r2, m) out <- r1 * r3


2

You're trying to do two things at once: reclassify the values of r2 and then multiply those by r1. Instead, do them separately: d <- 1:3/4 out = overlay(r1, calc(r2, fun=function(i) d[i]), fun="*") It is, of course, your responsibility to ensure that the values of r2 are all valid indexes into array d.


1

Ok Here is what I would do. Use the "Extract Values to Points" tool under "Extraction" which is in "Spatial Analyst Tools". You will use your point shapefile as the Input Point Feature and your continuous raster as the input Raster. I think that may be all you need to do. BTW instead of a 1-word comment, sometimes it is good policy to edit your question. ...


1

I see two fixes: For the first error: ERROR 000161: The length of the grid name must not exceed 13 characters Convert your output to tiff format, which does not have the character length limitations that the Esri grid raster format does. mamcnty_out = os.path.join(output_workSpace, "cnty_" + species_str + ".tif") For the second error: ERROR ...


0

Convert the raster to a polygon so you can calculate the area of the raster. Then convert the raster to a point shapefile to calculate the average depth. The volume is the area multiplied by the average depth.


0

From the GDAL PostGIS Raster driver documentation, last updated February 2014: write support to GDAL PostGIS Raster driver is under development The best available tool is still raster2pgsql on a local GeoTIFF file.


0

Perhaps try the package 'RapostgreSQL'. I'm not sure, if it will allow you to write spatial data to PostGresql, but you can try.


3

Both variables are zonal means. The average distance to the nearest facility is the zonal mean of the Euclidean distance grid (based on the facilities). The average number of facilities is the zonal mean of a one-kilometer radius focal sum of the facilities grid. (This is merely a grid whose cell values count the number of facilities within each cell. ...


0

You can follow through with the Downey method and raster. Since step one is done (polygon to raster your census tracts) you move on to step 2. First up will be Raster to Points to get a set of points that represent each raster cell. Once you have those you can use the same Spatial Join methods you would on the census tracts - after all, you're just trying ...


1

You could try mosaicing: Add every of your rasters to mosaic (top layers should be first). Set Mosaic Operator to First. Set Nodata value. Save mosaic as tif file. UPDATE: If you have changed your raster's symbology type to "classified" and want to overlay this images, then you can use Reclassify tool before mosaicing.


1

Note that clipper tool (from raster menu) distort your output, or may distort it by changing cell size. My suggestion is to use the clipper under gdal tools from the toolbox. There define -tr resx, resy in the additional parameters window; where both resx & resy > 0. Those stand for the input raster resolution, and forces the output to keep it. You can ...


0

To "delete" vector data (shape) use the clip tool in the vector menu (geoprocessing>clip). In the clip menu use the mask (i.e. borders of peru) as the clipping layer; for raster use the clipper in the raster menu (extraction>clipper). In the clipper menu choose the mask layer under clipping mode with your country borders shape as a mask Note that you are ...


0

A Raster Attribute Table (RAT) is the best way to associate string with pixel values. The formats with the best RAT support I know of are ERDAS Imagine (HFA) and KEA (KEA; http://kealib.org/). The steps I would use are: Write a raster with integer values (you can use GDAL to write a NumPy array). Add a RAT containing each pixel value (you can use the ...


1

Try this out: import arcpy, os, traceback, sys from arcpy import env env.workspace="in_memory" env.overwriteOutput = True try: def showPyMessage(): arcpy.AddMessage(str(time.ctime()) + " - " + message) mxd = arcpy.mapping.MapDocument("CURRENT") color_layer=arcpy.mapping.ListLayers(mxd,"silver.tif")[0] ...


0

A resolution of 1 is clearly not useful in this case. What you are seeing is a map of one raster cell (~ 9.5 - 10.5; 46.3 - 47.3) that has a single value (36). Had you provided more information, e.g. show(rMerge), it would have been very easy to spot. Do change the resolution and the results really should be different. But the resolution should be higher, ...


1

That's a simple add raster calculation. You just add them all together (r1+r2+r3+r4+r5) and the result is a raster where the value indicates how many species are present at each cell. You can't differentiate species, but that wasn't part of the original question. If you want to do that, you need to use something like the Combine tool in ArcGIS (Spatial ...


0

I'm not sure how practical this is for your given requirements, but you can try bitwise algebra. Given that you have a limited number of species, it might work. Bitwise algebra would work where the species are all represented by either 1, 2, 4, 8, 16, or a combination of those. For example, is species 1, 3 and 4 exist the cell would be represented by 1 + ...


1

You can do that in Python Console of QGIS by using a QgsRasterPipe object (pipe) for setting a renderer clone of the image employed as active layer before to use the 'writeRaster' method of QgsRasterFileWriter class (you don't need gdal_translate). I used the following code: layer = iface.activeLayer() extent = layer.extent() width, height = ...


2

If you're using ArcGIS, you can try the Extract Values to Points tool. It should give you the temperature at each point, assuming they intersect your temperature raster.


1

You can accomplish this with multiple layers pointing to the same raster source. Give each layer its own separate scale range and symbology. If you wanted to have a particular symbology between 1:25 and 1:100, you'd set those values on the General tab as shown below. Then choose the appropriate symbology on the Symbology tab. Then you might have, say, two ...


1

The quickest solution would be to load the data into LibreOffice Calc, and sort the data on the second column, then the first one ascending. The result should look like: 426000.78;55000.15;562.24 426001.78;55000.15;562.22 426002.78;55000.15;562.20 426003.78;55000.15;562.30 426004.78;55000.15;562.21 426005.78;55000.15;562.21 426006.78;55000.15;562.27 .... ...


2

Here's a little background info on raster bands. Think about it like this: an RGB image would have 3 bands, one for red, one for green, and one for blue. Each raster cell would have 3 values, one for each band. The Landsat imagery has 4, because they include an extra band for infrared values as well. In your case, there is only one band because each cell ...


0

Have you tried installing the LASTools Qgis plugin: For usage and installation, you can follow a tutorial : Follow this link Or the Qgis docs and this link And then import ur dataset using this tools Hope that helps


1

Your best bet to get a weighted choice is to use numpy.random.choice which allows you to specify the sample set, and a weight for each sample. Note the probability must sum to exactly 1. raster = numpy.random.choice([0, 1], size=(rows, cols), p=[0.65, 0.35]) Also, a quick note: your comment says the probability that the landuse should be allocated to 1 or ...


-2

After clasiification you can Convert Raster to Polygon in Arcgis and then Open the attribute tables to fetch the area of each class of polygons.


2

There's a few problems in your script, but that's ok, you have to start somewhere. Firstly, your teacher is right, desc.extent is an object, from the Dataset properties and you can read more about the Extent Object. You don't just convert it to a string. Secondly, variables are used as such and don't get quoted "inRaster" is a string inRaster but inRaster ...


0

If you use free SAGA GIS (http://www.saga-gis.org/), you have some interesting options to calculate vertical distance to river. I recommend the algorithms, both on the toolbox cold "Terrain Analysis - channels": "overland flow distance to channel network" and "vertical distance to channel network". Each one has a different approach. The "overland flow ...


2

Are the reservoir data you have vector data (points or polygons)? If so, your best bet is to make a quarter-mile buffer around the reservoir using the Buffer tool. Then, use Zonal Statistics in the Spatial Analyst extension to extract the raster values. I'm not sure what values are associated with your raster layers, but you may have to investigate using the ...


2

It is fairly straight forward to set up the looping logic with an i,j index. However, I do not quite get your logic. What happens after (n - 4)? You can only calculate the adjusted mean to day 361. Why does calc or overlay, with movingFun, not work for you? That aside, addressing your question, the missing piece is that you index rasters in a stack using ...


1

I have made a rough code example, that uses simple structures and attempts to make the script easy to understand and follow. It is likely that it is inefficient and could be structured much better. The fact that you have 3 years is the key that we need to consider here (I will completely disregard the potential of a leap-year). Adding additional years is ...


1

Two options are available You can either set values to zero '999 -> 0' or remove them entirely from the raster '999 -> nodata'. Set to zero '999 -> 0' with the raster calculator (Raster > Raster Calculator): ("my_rasterA@1" > -999) * "my_rasterA@1" Set to NA '999 -> nodata', use Translate (Raster > Conversion > Translate) Save the output from the ...


0

SA free approach is 1) convert raster to points, 2) spatial join points to polygons 3) select values greater 50 4) apply summary statistics using polygon id as case field. Could be very slow, depending on raster size


1

Unfortunately this is an issue in the current version. We created this function and it worked well (at least on my linux notebook) and it went down some months ago. You can contribute to this issue Nevertheless you can reproject any raster to EPSG 4326, translate it to jpg and embed it by hand in your webmap project. I solved this issue now and you can ...


2

You can do this in two steps. First, use Con (Spatial Analyst) to convert cells > 50 to 1 and all other cells to 0. Then use Zonal Statistics as Table (Spatial Analyst) to count the number of "1" cells within your polygon.


1

The only way that I know of to do this, requires spatial Analyst so perhaps I'll write it up as such and if it is possible another way, someone else will write that up as a separate answer. With the Spatial Analyst Extension, the tool to use is Zonal Statistics. I typically use Zonal Statistics As Table. I typically use a projected coordinate system ...


0

Thank you @dof1985 and @John Barca. Importing numPy was the issue here. Please refer to the link within the question to view essentially the same question (sorry for the duplicate everyone) with alternate solutions. The solution here was pretty much me moving to another computer that had correctly installed ArcGIS. I believe numPy on my home computer is ...


1

Here is a code, a bit brute force, but your rasters do not seem to be that big. I give the code with some matrices as an example that you can run and see it works. Some modifications for your code are needed. Basically, the trick here is to use grep() to find the number in the raster names' vector and to subset the name of th variable as a string. Then ...


1

Get the coordinates of the cell centres and create a Spatial object: spts <- rasterToPoints(r, spatial = TRUE) Transform the points to your desired target: library(rgdal) llprj <- "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs +towgs84=0,0,0" llpts <- spTransform(spts, CRS(llprj)) The values are already copieds as columns on this ...


2

Just use the ArcGIS raster calculator with a CON statement. CON(("h2005" - "h2015") >= 30, 1, 0) This will result in a binary raster where [1] represents differences of >= 30m and [0] no change at this threshold. And yes, set your analysis environment for extent and snap raster.


2

You have two inputs: A polygon layer of Census counts. A classified land cover layer. You would like to perform a kind of dasymetric mapping in which the output is a density raster. It has two defining properties: The integrated density over each Census block should equal the original count. The different types of land cover should have differing ...


3

you need to actually reproject the raster into a geographic (decimal degrees) projection using "projectRaster" or "spTransform". Also look at CRS sp definitions that specify your desired projection string. The example in the help for the "projectRaster" is quite clear in how to do this. If you coerce your raster data into a SpatialPointsDataFrame object ...


0

It appears that you have Projected Coordinates there (not Latitude / Longitude aka GCS Coordinates). It probably wasn't clear to you that that was the problem. See this post. Converting geographic coordinate system in R


3

It is just a synonym for the raster data you want to analyse. Unlike vector features, which are built from a geometry attribute (i.e. coordinates) and an attribute table, rasters are both geometry and attributes. A raster is a grid of cells (pixels), each containing a VALUE (hence 'raster value'). The value can stand for whatever attribute one wishes, yet ...


1

You can use the r.series GRASS command in QGIS to accomplish this.


0

As a work-around, you can use the Split Raster (Data Management) tool to do this. Here is a basic example, although you can adjust the parameters to include overlapping tiles, etc. import arcpy, os outws = r'C:\temp\split_raster' raster = r'C:\temp\split_raster\yourRaster.tif' fishnet = r'C:\temp\split_raster\fishnet.shp' arcpy.SplitRaster_management ...



Top 50 recent answers are included