Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What should I do if one class is missing from one of the input maps #12

Open
lluisvicens opened this issue Apr 1, 2016 · 6 comments
Open
Labels

Comments

@lluisvicens
Copy link

Corine layers: corine.zip

I'm trying to perform an analysis of land use/cover change detection using QGIS and MOLUSCE but I get an error message. I'm working with two CORINE raster layers (1990 vs 2006) and other two optional layers as a Spatial variables (distance to roads, distance to rivers). I successfully completed the "Inputs" and "Evaluating Correlation" tabs processes, but when I get to "Area Changes" tab, and I press the "Update tables" or "Create changes map", I always get the same python error message:

Here it goes the error log message:

2016-04-01T12:49:16 1 Traceback (most recent call last):
File "/home/lluis/.qgis2/python/plugins/molusce/moluscedialog.py", line 413, in updateStatisticsTableDone
self.__drawTransitionStat()
File "/home/lluis/.qgis2/python/plugins/molusce/moluscedialog.py", line 1027, in __drawTransitionStat
stat = self.inputs["crosstab"].getTransitionStat()
File "/home/lluis/.qgis2/python/plugins/molusce/algorithms/models/crosstabs/manager.py", line 91, in getTransitionStat
deltas = finalArea - initArea
ValueError: operands could not be broadcast together with shapes (25,) (21,)

I'm working with QGIS 2.14.1 and MOLUSCE 3.0.11 under Ubuntu 14.04 LTS. I've tried the same on a Windows machine with same error message.
Thanks.

@simgislab simgislab added the bug label Apr 1, 2016
@KolesovDmitry
Copy link
Contributor

@lluisvicens , you have different landuse types in your data:

  • clc2006.tif has the next landuse types: 1., 2., 3., 4., 6., 7., 8., 9., 10., 11., 12., 13., 16., 18., 20., 21., 23., 24., 25., 26., 28., 29., 32., 33., 40
  • clc1990.tif has the next: 1., 2., 3., 7., 9., 11., 12., 13., 16., 18., 20., 21., 23., 24., 25., 26., 28., 29., 32., 33., 40.

For example, landuse types '4', '6' are not presented in the second raster. It means that the module can't calculate transition statistics

@lluisvicens
Copy link
Author

Thanks Dmitry for your answer and help.

May I do a question?
Then point is, how can I proceed when for instance, a class in the initial layer has disappeared in the final layer (such as burnt area)? How should I detect and compute how the rest of the classes have changed in a period of time? If a single land cover class disappears within a period, is this meaning that there is no possibility to continue with the land cover change analysis?

@KolesovDmitry
Copy link
Contributor

@lluisvicens , I don't know answers for your questions :( For the current state of the module the init-raster and final-raster must have the same landuse classes. Probably the issue can be solved with small code change, but I'm not sure.

We have developed the module using the next assumptions and user story:

  • an user have init-state-raser, final-state-raser and some factors;
  • the user creates models to evaluate landuse transitions;
  • the user creates new-state-landuse-raster using the model and the factors;

We expect that the model works in constant enviroment (there aren't sudden changes in factors and external medium). For example if an user studies deforestation and some parts of the territory became a National park in the studied time period, the module isn't applicable (external medium have changed). More precisely the limits of the models are (we assumed that):

  • factors must be relevant to describing landuse transition probabilities (factors provide location for transitions);
  • the landuse transition percentages are constant for the studied time (the medium didn't change). For example if we have N% of transition for Class1 -> Class2 (in transitions for init-raster -> final-raster), we will expect the same of N% transition for Class1 -> Class2 (in transitions for final-state-raster -> new-state-raster).

In case of your question. Actually we haven't thought about such possibility as elimination of a landuse class during the landuse evaluation process.

In your case you have N% of transition Class1->Class2 for the firs pair of rasters (init-final), but you don't have even one pixel for make the transition for the second pairs of rasters (final-new). As result, the model became inapplicable (and we haven't programmed this possibility)... But on the other hand I don't see a fundamental objection to use a trained model without the disappeared landuse class.

The main question is: can be the trained model applicable in such condition or can't be. I don't know, I have to think about it :)

@simgislab
Copy link
Member

Then point is, how can I proceed when for instance, a class in the initial layer has disappeared in the final layer (such as burnt area)? How should I detect and compute how the rest of the classes have changed in a period of time? If a single land cover class disappears within a period, is this meaning that there is no possibility to continue with the land cover change analysis?

@lluisvicens I'd suppose there an easy answer to your question, turn your 'disappearing' class to NODATA before running the analysis

@simgislab simgislab added question and removed bug labels Apr 1, 2016
@simgislab simgislab changed the title Python error using MOLUSCE plugin in QGIS 2.14.1 What should I do if one class is missing from one of the input maps Apr 1, 2016
@simgislab
Copy link
Member

I've added another issue to provide more informative error message

@lluisvicens
Copy link
Author

A lot of thanks Maxim and Dmitry for your kind reply. I will take in consideration your hints, and in the meantime I won't consider the 'disappearing classes' between init-raster and final-raster and I will focus the analysis on the classes that are present on both layers.

I will keep an eye on future versions on MOLUSCE, just in case... ;)
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants