profile
viewpoint
If you are wondering where the data of this site comes from, please visit https://api.github.com/users/marisn/events. GitMemory does not store any data, but only uses NGINX to cache data for a period of time. The idea behind GitMemory is simply to give users a better reading experience.
Māris Nartišs marisn A Geographer (PhD), free/libre software enthusiast, sometimes pretending to be an entrepreneur.

marisn/grass 1

GRASS GIS Core Repository

marisn/timlab 1

Training IMage LABeler

ploewe/MOSS 1

Transient repo for the rediscovered MOSS codebase + auxiliary files.

marisn/AcATaMa 0

AcATaMa is a Qgis plugin for Accuracy Assessment of Thematic Maps

marisn/crispy-bootstrap5 0

Bootstrap5 template pack for django-crispy-forms

marisn/django-advanced-filters 0

Add advanced filtering abilities to Django admin

marisn/django-userena 0

Accounts for Django made beautifully simple

marisn/docs 0

Source repository for the mapserver documentation site. Please submit pull requests on branch-7-0 , not master

marisn/exiv2 0

Image metadata library and tools

marisn/gdal 0

GDAL is an open source X/MIT licensed translator library for raster and vector geospatial data formats.

PullRequestReviewEvent
PullRequestReviewEvent

Pull request review commentOSGeo/grass

r.resamp.interp: implement parallelization with OpenMP

 int main(int argc, char *argv[])      G_get_set_window(&dst_w); +    sscanf(nprocs->answer, "%d", &threads);+    if (threads < 1)+    {+      G_fatal_error(_("<%d> is not valid number of threads."), threads);+    }+#if defined(_OPENMP)+    omp_set_num_threads(threads);+#else+    threads = 1;

The code is correct, but how about:

if (threads != 1)
    G_warning(_("GRASS is compiled without OpenMP support. Ignoring threads setting."));
threads = 1;
aaronsms

comment created time in 3 days

PullRequestReviewEvent
PullRequestReviewEvent
PullRequestReviewEvent

pull request commentOSGeo/grass

r.univar: Add parallel support

As for this particular case (OOM), do you envision the Python code to do some heuristics for memory requirements of r.surf.fractal versus your size of your RAM and do benchmarks according to that?

Heuristics would be good, but might need too much work. Probably the easiest solution would be to add try: except: around r.surf.fractal calls to not fail if OOM situation is encountered.

aaronsms

comment created time in 3 days

PullRequestReviewEvent

Pull request review commentOSGeo/grass

r.univar: Add parallel support

 int main(int argc, char *argv[]) 	    } 	} +    sscanf(param.threads->answer, "%d", &threads);+    if (threads < 1)+    {+      G_warning(_("<%d> is not valid number of threads. Number of threads will be set to <%d>"),

Don't do any tricks if the input is invalid, just bail out completely (G_fatal_error). At the moment the code is incorrect – if one sets param.threads to 0, it will use abs(0) as the number of threads.

aaronsms

comment created time in 5 days

Pull request review commentOSGeo/grass

r.univar: Add parallel support

 process_raster(univar_stat * stats, int fd, int fdz, const struct Cell_head *reg 	if (!(param.shell_style->answer)) 	    G_percent(row, rows, 2);     }+    G_free(raster_row);+    if (n_zones)+        G_free(zoneraster_row);     if (!(param.shell_style->answer)) 	G_percent(rows, rows, 2);	/* finish it off */  }++#if defined(_OPENMP)+static void+process_raster_threaded(univar_stat * stats, char *fname, char *zone_fname, const struct Cell_head *region, const int threads)+{+    /* use G_window_rows(), G_window_cols() here? */+    const unsigned int rows = region->rows;+    const unsigned int cols = region->cols;+    const int n_zones = zone_info.n_zones;++    const char *mapset;+    const char *zone_mapset;+    mapset = G_find_raster2(fname, "");+    if (n_zones) {+        zone_mapset = G_find_raster2(zone_fname, "");+    }++    /* open file per thread */+    int *fd, *fdz;+    fd = G_malloc(threads * sizeof(int));+    if (n_zones) {+        fdz = G_malloc(threads * sizeof(int));+    }+    for (int i = 0; i < threads; i++) {+        fd[i] = Rast_open_old(fname, mapset);+        if (n_zones)+            fdz[i] = Rast_open_old(zone_fname, zone_mapset);+    }++    const RASTER_MAP_TYPE map_type = Rast_get_map_type(fd[0]);+    const size_t value_sz = Rast_cell_size(map_type);+    void **raster_row;+    CELL **zoneraster_row = NULL;+    raster_row = G_malloc(threads * sizeof(void*));+    if (n_zones) {+        zoneraster_row = G_malloc(threads * sizeof(CELL*));+    }+    for (int i = 0; i < threads; i++) {+        if (NULL == (raster_row[i] = Rast_allocate_buf(map_type))) {+            return;+        }+        if (n_zones != 0 && (NULL == (zoneraster_row[i] = Rast_allocate_c_buf()))) {+            return;+        }+    }++    int n_alloc = n_zones ? n_zones : 1;+    size_t **n = G_malloc(threads * sizeof(size_t*));+    double **sum = G_malloc(threads * sizeof(double*));+    double **sumsq = G_malloc(threads * sizeof(double*));+    double **sum_abs = G_malloc(threads * sizeof(double*));+    double **min = G_malloc(threads * sizeof(double*));+    double **max = G_malloc(threads * sizeof(double*));+    size_t **size = G_malloc(threads * sizeof(double*));++    for (int i = 0; i < threads; i++) {+        n[i] = G_calloc(n_alloc, sizeof(size_t));+        sum[i] = G_calloc(n_alloc, sizeof(double));+        sumsq[i] = G_calloc(n_alloc, sizeof(double));+        sum_abs[i] = G_calloc(n_alloc, sizeof(double));+        size[i] = G_calloc((n_alloc), sizeof(size_t));

There is no need for round brackets around n_alloc.

aaronsms

comment created time in 5 days

Pull request review commentOSGeo/grass

r.univar: Add parallel support

+"""Benchmarking of r.univar++@author Aaron Saw Min Sern+"""++from grass.pygrass.modules import Module+from subprocess import DEVNULL++import grass.benchmark as bm

I assume this needs a rebase on top of current master.

aaronsms

comment created time in 5 days

PullRequestReviewEvent
PullRequestReviewEvent

delete branch marisn/grass

delete branch : system_locale_parsing

delete time in 6 days

delete branch marisn/grass

delete branch : lidar_filter

delete time in 6 days

delete branch marisn/grass

delete branch : fix_StaticWrapText

delete time in 6 days

delete branch marisn/grass

delete branch : gunittest_fixes

delete time in 6 days

delete branch marisn/grass

delete branch : wenzeslaus-pdal-binning

delete time in 6 days

delete branch marisn/grass

delete branch : bandrefs

delete time in 6 days

delete branch marisn/grass

delete branch : g_subelement

delete time in 6 days

push eventmarisn/grass

Andrea Giudiceandrea

commit sha 1f558868b63208ec92b14bf80c1cf579c5edc8c9

ci: Fix OSGeo4W workflow (#1757) osgeo4w-setup-x86_64.exe executable was renamed osgeo4w-setup-x86_64-v1.exe

view details

Vaclav Petras

commit sha 3130a47d7c15080ddfb03ae706e7880ebd8153d6

libpython: Add plot nprocs to benchmark CLI (#1761) * Adds new subcommand plot nprocs. * Uses more general plot title. * Allows user to select results by label. * Prefixes can replace labels instead of prefixing them. * Adds test for plot nprocs (uses nprocs with r.univar, so it is skipped in 8.0).

view details

Anna Petrasova

commit sha d5012a3deb94cfcb683b0b014b3414e210049404

wxGUI: remove deprecated methods from MapDisplay (#1729) replace deprecated IsStandalone and GetLayerManager methods by giface, signals

view details

Anna Petrasova

commit sha 329f02966653abe036799516826cce4675bc9f8d

wxGUI: fix deleting dict key while iterating (#1763)

view details

Anna Petrasova

commit sha d03c8cb72e326a4ea421596b778304f7eafd4bea

wxGUI: fix layout flag assert in wms dialog (#1764)

view details

Vaclav Petras

commit sha 5a76c704e938d54b93821bd0ce42ab247f7de812

init: Update doc for non-interactive jobs (#1753) - Remove GRASS_BATCH_JOB from the documentation (removed in aeff9f46465154bac239227dc3fc1f2247d24100). - Non-interactive jobs section now part of the Description section, not environmental variables section. - Flags section removed, moved to Description sec as Config flag sec (only flag described there).

view details

nilason

commit sha 602a63020f8776b72390e11bb0a52dc87faa8784

gunittest: init super() to initialise 'errors' attribute (#1685) Fix error with message: "AttributeError: 'GrassTestLoader' object has no attribute 'errors'"

view details

Māris Nartišs

commit sha 7e30d84ed8992d039a74124b142bc1ffe2374fad

Improve G_open|find _misc function documentation (#1760) Lib GIS: improve documentation for G_file_name_misc, G_find_file_misc and G_fopen_(old|new)_misc

view details

Aaron Saw Min Sern

commit sha e97de6b8d42dca65fc7a7cb56152c56ec18b24bd

r.slope.aspect: Run indent script on C files (#1765)

view details

Aaron Saw Min Sern

commit sha f12f14579009a47d1aba483ccef1738b613261f2

parser: Add NPROCS GIS env var to set default for nprocs (#1734) * This adds an NPROCS GIS environment variable. * This change allows to globally override the default value (1) with a user defined value for the nprocs option using g.gisenv. * This follows the existing implementation for memory with MEMORYMB variable (PR #922). * nprocs option already exists, so this adds only the variable NPROCS and its documentation.

view details

Linda Kladivova

commit sha 5f65aaa9787bea1bcddd89939bbd15af7c7f93a3

wxGUI: refactoring: build GUI tools' status bars based on wx.StatusBar widget (#1689) Builds status bars based on wx.StatusBar for SwipeMapFrame, IClassMapFrame, Image2Target Frame, Photo2Image Frame, and GCP manager MapFrame. Some general methods related to a status bar and toolbars moved to gui_core class MapFrameBase.

view details

Caitlin H

commit sha fd19e91c70080ff6b84d7e4f17408e1b9d946318

jupyter: Add `__getattr__` shortcut for calling GRASS display modules (#1723) Shortcut allowing users to call GRASS display modules (d.*) with method .d_*. Method name must start with d and underscore and it needs to be an executable on path, other error handling is left to the underlying functions. Example is in the Jupyter integration notebook.

view details

Linda Kladivova

commit sha 0537933d1c09ab23bfe59e9fb3240735a879cde1

wxGUI: Single-Window GUI: Integrate new map display wx.Panels into a AuiNotebook center pane #1735 (#1732)

view details

push time in 6 days

pull request commentOSGeo/grass

Integrate band references into portable signature files

Any NC SPM examples for the manual? Or at least as a test where "non-sense" is fine. Spearfish is not readily available in Binder or CI.

I updated a bit documentation of modules. As these changes are more internal than external, there are almost no changes for previous workflows. Only new thing is the requirement of having band references set for all rasters used for classification. The rest stays the same.

With current content of NC location I do not see how to nicely expose new opportunities revealed by move to portable signature files. That would need e.g. another set of LANDSAT 7 scenes.

Overall – I wouldn't call work on new signature files complete – I did all work in the library part, but a module for signature file management is still missing. Also, as you noted, would be nice to have an example displaying benefits of the new approach. But never the less, I would like to merge this ASAP to be able to move forward with 8.0 release. Missing bits can be added also later. @nilason could you, please, re-run tests on your machine to see if all issues are now fixed?

marisn

comment created time in 8 days

push eventmarisn/grass

Māris Nartišs

commit sha 620d4bacf5969bc341bd0c337080876a3d73f5c5

Imagery: improve documentation with notes on signature file portability

view details

push time in 8 days

PullRequestReviewEvent

Pull request review commentOSGeo/grass

Integrate band references into portable signature files

+/*!+   \file lib/imagery/manage_sinatures.c++   \brief Imagery Library - Signature file management functions++   (C) 2021 by Maris Nartiss and the GRASS Development Team++   This program is free software under the GNU General Public License+   (>=v2). Read the file COPYING that comes with GRASS for details.++   \author Maris Nartiss+ */++#include <unistd.h>+#include <string.h>++#include <grass/gis.h>+#include <grass/imagery.h>+#include <grass/glocale.h>++static int list_by_type(int, const char *, int, char ***);++/*!+ * \brief Remove a signature file+ * + * If removal fails, prints a warning and returns 1.+ * It is safe to pass fully qualified names.+ * + * \param type SIGFILE_TYPE_ signature type+ * \param name of signature to remove+ * \return 0 on success+ * \return 1 on failure+ */+int I_signatures_remove(int type, const char *name)+{+    char xname[GNAME_MAX], xmapset[GMAPSET_MAX];+    char selem[GNAME_MAX];++    G_debug(1, "I_signatures_remove(%d, %s);", type, name);++    /* Remove only if file is in the current mapset */+    if (G_name_is_fully_qualified(name, xname, xmapset) &&+        strcmp(xmapset, G_mapset()) != 0) {+        G_warning(_("%s is not in the current mapset (%s)"), name,+                  G_mapset());+        return 1;+    }+    if (I_find_signature2(type, name, G_mapset())) {+        if (type == SIGFILE_TYPE_SIG)+            sprintf(selem, "signatures%csig", HOST_DIRSEP);+        else if (type == SIGFILE_TYPE_SIGSET) {+            sprintf(selem, "signatures%csigset", HOST_DIRSEP);+        }+        if (G_remove(selem, name) == 1) {+            G_verbose_message(_("%s removed"), name);+            return 0;+        }+        G_warning(_("Unable to remove %s signature"), name);+    }+    else+        G_warning(_("%s is missing"), name);+    return 1;+}++/*!+ * \brief Copy a signature file+ *+ * If copy fails, prints warning messages and returns 1.+ * It is safe to pass fully qualified names.+ *+ * \param type SIGFILE_TYPE_ signature type+ * \param name of old signature+ * \param mapset of old signature+ * \param name of new signature+ * \return 0 on success+ * \return 1 on failure+ */+int I_signatures_copy(int type, const char *old_name, const char *old_mapset,+                      const char *new_name)+{+    char tname[GNAME_MAX], tmapset[GMAPSET_MAX];+    char selem[GNAME_MAX];+    const char *smapset;+    char old_path[GPATH_MAX], new_path[GPATH_MAX];++    G_debug(1, "I_signatures_copy(%d, %s@%s, %s);", type, old_name,+            old_mapset, new_name);++    /* Copy only if mapset of new name is the current mapset */+    if (G_name_is_fully_qualified(new_name, tname, tmapset)) {+        if (strcmp(tmapset, G_mapset()) != 0) {+            G_warning(_("%s is not in the current mapset (%s)"), new_name,+                      G_mapset());+            return 1;+        }+    }+    else+        strcat(tname, new_name);++    smapset = I_find_signature2(type, old_name, old_mapset);+    if (!smapset) {+        G_warning(_("%s is missing"), old_name);+        return 1;+    }++    if (type == SIGFILE_TYPE_SIG)+        sprintf(selem, "signatures%csig", HOST_DIRSEP);+    else if (type == SIGFILE_TYPE_SIGSET) {+        sprintf(selem, "signatures%csigset", HOST_DIRSEP);+    }++    G_make_mapset_element(selem);

I implemented a version of workaround.

marisn

comment created time in 9 days

Pull request review commentOSGeo/grass

Integrate band references into portable signature files

 /*!    \brief Create signature file -   \param group group name-   \param subgroup subgroup name in given group    \param name signature filename -   \return pointer to FILE*+   \return pointer to FILE    \return NULL on error */-FILE *I_fopen_signature_file_new(const char *group,-				 const char *subgroup, const char *name)+FILE *I_fopen_signature_file_new(const char *name) {-    char element[GPATH_MAX];-    char group_name[GNAME_MAX], group_mapset[GMAPSET_MAX];     FILE *fd; -    if (!G_name_is_fully_qualified(group, group_name, group_mapset)) {-	strcpy(group_name, group);-    }+    /* create sig directory */+    G__make_mapset_element_misc("signatures", "sig");

I reworked the element creation to mimic vector lib approach with an internal function. Now it should be enough for a temporary workaround.

marisn

comment created time in 9 days

PullRequestReviewEvent

push eventmarisn/grass

Māris Nartišs

commit sha 1984387ed9d5f44bb816ef09b9f8c4d5f9ed2f76

Imagery: simplify signatures sub-element handling with internal functions

view details

push time in 9 days

push eventOSGeo/grass

Māris Nartišs

commit sha 7e30d84ed8992d039a74124b142bc1ffe2374fad

Improve G_open|find _misc function documentation (#1760) Lib GIS: improve documentation for G_file_name_misc, G_find_file_misc and G_fopen_(old|new)_misc

view details

push time in 9 days

PR merged OSGeo/grass

Improve G_open|find _misc function documentation

lib/gis functions dealing with elements are hard to understand due to opposite layout in the mapset for "normal" and "misc" elements:

  • in the "usual" case element = directory with named files or folders (e.g. vector/my_roads/; cell/my_raster)
  • in the "misc" case element = file inside a named subfolder (e.g. cell_misc/my_raster/history; group/my_group/REF)

This PR just replaces factually wrong documentation of G_open_misc and adds notes to G_find_file and G_file_name.

+72 -23

0 comment

3 changed files

marisn

pr closed time in 9 days