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

Exporting with gis:patch-dataset #14

Closed
seanbergin opened this issue Feb 23, 2017 · 9 comments
Closed

Exporting with gis:patch-dataset #14

seanbergin opened this issue Feb 23, 2017 · 9 comments

Comments

@seanbergin
Copy link

I'm not sure whose error this (Netlogo vs the extension)- and forgive me if I'm missing something obvious.

In my model which works in 5.3 I create a map to export with:

let output-map gis:patch-dataset arrival-date

arrival-date is a patch variable. This works great (Thanks for creating and maintaining this extension) in 5.3.

In version 6 of Netlogo I now receive an error because I'm trying to access a patch variable from an observer context. I can't seem to run this one piece of code without the editor flagging it - no matter where I put it.

Thanks!
Sean Bergin

@lukepc
Copy link

lukepc commented Apr 10, 2017

Hey Sean,

This works for me:

to store-raster
  
  let patches_out nobody
  
  ask patches [
    set patches_out gis:patch-dataset pcolor
  ]  
  
  gis:store-dataset patches_out "patch_out.asc"
  
end

However, for large worlds it takes a very long time since it queries each patch, so I wonder if there is something that is closer to the reverse of "apply-raster" in terms of speed.

@seanbergin
Copy link
Author

Thanks for looking at this. Previously (v5.3) I used the

set patches_out gis:patch-dataset pcolor

without being inside of the ask patches and it worked just fine.

The Netlogo 6 editor flags that as incorrect (specifically the editor then believes the method is no longer in observer context and doesn't like that the tick command is present)

If I add the ask patches to my Netlogo version 6.0 code, it works again in the editor. However, as you noted this slows things WAY down. I have large maps. While you are right that the code you posted works in the editor - I don't think this is the way it is supposed to work. As you said it is asking each patch to create the entire map. I think it should just make the map - without the ask patches statement surrounding it.

Thanks

@lukepc
Copy link

lukepc commented Apr 11, 2017

Agreed- I had been playing around with syntax before stumbling on the ask patches solution, but it does seem like the 5.3 version is faster and more intuitive/correct. If you figure out or hear about a better way for 6.0, please let me know!

@lukepc
Copy link

lukepc commented Apr 12, 2017

Update, Sean- as you mentioned, each patch was being asked to create the entire map. However, I tried using one-of and that appears to have solved my problem- not sure if it would work for you.

to store-raster-2
  
  let patches_out nobody
  
  ask one-of patches [
    set patches_out gis:patch-dataset pcolor
  ]
  
  gis:store-dataset patches_out "patch_out_check.asc"
  
end

@mrerrormessage
Copy link
Contributor

Thanks for posting this, sorry it has taken me so long to respond. This was a bug introduced in NetLogo 6. The one-of fix is a great temporary workaround until we can get a fix for this.

@seanbergin
Copy link
Author

Indeed, thanks for the work around! It has been working flawlessly.

Cheers!

@lukepc
Copy link

lukepc commented Apr 18, 2017

Thanks guys, glad it works!

@mrerrormessage
Copy link
Contributor

mrerrormessage commented May 17, 2017

Just wanted to provide an update on this. The problem is in NetLogo, so the fix will come in the next version of NetLogo instead of a new release of the GIS extension. Progress can be tracked on that fix here. I expect to merge the changes in within the week and they should be usable immediately after merge if you're interested in running NetLogo from source. Thanks so much for reporting this!

@lukepc
Copy link

lukepc commented May 17, 2017

Awesome, thank you for the heads-up. Cheers!

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

No branches or pull requests

4 participants