Hello,
I have a question about how I should use NetLogo and folder organization.
I have a model that takes several .asc files from a folder called "layers" and generates several .csv outputs. This folder "layers", the model in .nlogo and the outputs to be generated are inside a folder called "working" which in turn is on the desktop of my notebook (my system is Windows 10 Home 64 bits). I have 2 weeks trying to resolve an error that appears in the code that s:
The file C:\Users\rafa\Desktop\working\file_Landscape3_EVI1_seed1.csv cannot be found
error while turtle 652 running FILE-PRINT
called by procedure OUTPUT
called by procedure DIEPROC
called by procedure GO
called by Button 'Go'
However, this error above is meaningless, because in the "working" folder the file is open there waiting to be filled with data. So, by chance, yesterday, I decided to copy this "working" folder from the desktop and put it in the C directory and simply ran the model without any error!!!!
So, I have the following questions:
1) Is there any way to fix a directory in NetLogo? I saw it has the set-current-directory string. And then I had one more doubt, every time I open the model I will have to specify the path, correct?
2) Is there an ideal way to name folders?
3) Is there a better directory that I should use to run NetLogo, i.e. is it better to use C than desktop?
4) Why did the model run in C and not run and show the above error when the "working" folder is on the desktop?
I would like to note that I am a computer architecture layman and a NetLogo beginner. So sorry if I was redundant or if I said something nonsense. It's just that I got confused and I'd like to understand and solve this dilemma :) lol
Below, a part of code:
extensions [ gis ]
globals [
Resources
Landcover
RandomSeed
NumResourceFiles
NumLandscapeFiles
]
patches-own [
resource-value
habitatcover
]
to setup
clear-all
set RandomSeed 1
random-seed RandomSeed
set NumResourceFiles 1
set NumLandscapeFiles 1
prepare-output
setup-layers
reset-ticks
end
to prepare-output
if output? = true ;; output: is switch in interface
[
let numLand word "_Landscape" NumLandscapeFiles
let numResource word "_EVI" NumResourceFiles
let numSeed word "_seed" RandomSeed
carefully
[ file-delete ( word outfile numLand numResource numSeed ".csv" ) ] ;; outfile in a input interface (string). tnhe name used "file"
[ ]
file-open ( word outfile numLand numResource numSeed ".csv" )
file-print ( word "id,distance_traveled" )
file-close
]
end
to setup-layers
let num NumLandscapeFiles
let num2 NumResourceFiles
set Resources gis:load-dataset ( word "./layers/L" num "_EVI0" num2 ".asc" ) ;; examples of name files: L1_EVI01.asc L2_EVI01.asc L1_EVI02.asc
set Landcover gis:load-dataset ( word "./layers/L" num "_MAP.asc" ) ;; examples of name files: L1_MAP.asc
gis:set-world-envelope gis:envelope-of Resources
gis:apply-raster Resources resource-value
gis:apply-raster Landcover habitatcover
; color-Resources
; color-map
end
Thanks in advance!!!