BrianBGrant / DNDCv.CAN

This is our development version of DNDCv.CAN. The model is under ongoing development. Please report issues.
9 stars 4 forks source link

console options #11

Open RamiALBASHA opened 9 months ago

RamiALBASHA commented 9 months ago

Dear Brian,

Could you please provide a list with all options that the console executable requires?

I have been trying to get them as:

.\DNDC95.exe --help

but I get in return (same with -h and /?):

image

Thanks in advance

P.S. I'm exploring options to prevent DNDC from poping up windows when some errors occure (e.g. in silent mode). I have just opened a separate issue (#10) for this last question in order to keep one issue by question.

BrianBGrant commented 8 months ago

Here is a snippet from the console executable readme file.

example "start /wait dndc95.exe -output [yourpathname to output results directory] -s [batch txt file you want to run: Should be in the same directory as exe] -daily [0 (no daily files) or 1 {for daily output generation)] -root [where your root DNDC95 directory is located]"

command line example "start /wait dndc95.exe -root D:\DNDC -output D:\outputDNDC -s D:\DNDC\TONY\BatchDND\Barley_all.txt -daily 0"

ramsaym commented 1 week ago

I'm on a similar path as Rami except I'm trying to run a single dndc file from the command line and inject climate data for points across my AOI with each run. I keep getting a permission denied error for the output folder despite giving it full permissions and running CMD as administrator. Any ideas on what might be missing here to let this run. I've got some python code to create 125 virtual weathers stations from NASA power from a coordinates input list and this will spit out valid DNDC climate files for each coordinate using pandas. I thought I had the hard part worked out but these command line quirks have stalled me out. Any help appreciated. I did try the full path to the output folder as well as C:\DNDC\batchResult

running this: start /wait dndc95.exe -output batchResult -s C:\DNDC\batch_dnd.txt -daily 1

BrianBGrant commented 1 week ago

Hi Ramsaym, so if I understand your issue correctly you're trying to run a singular dnd file using the batch command and then repeat the process multiple times but overwrite your climate folder each run across your assessment? The issue is once you've initiated the python code to run the singular run you get locked out of the climate folder write permissions? Is that correct? I'll start by saying this isn't how I'd normally try to build the assessment so it's a bit of a novelty to me. It seems like you've not let the program exit the execution loop before you are trying to overwrite files in the climate directory and thus the model has still got the file handlers open for the climate directory and not giving you permission. Feels like this is something that can be solved within the script (not the model).

My normal plan would be just to build a R-script to permutate through the climate iterations and build independent dnd's for each independent climate run rather than using a singular dnd file to represent all the permutations. I'll poll my operations team to see if they have ideas on your issue (if I understand it properly).

In terms of your command line switches it looks appropriate (maybe add the full path for your -output directory). Just to be safe I'd suggest adding the -root command to point to the directory for the base executable/interim files so in your case -root C:\DNDC just to see if helps.

ramsaym commented 1 week ago

Thanks Brian, It's actually giving me the permission error before writing any files at all. I'm piping the output to a different location each time using a batch script so I don't think it's locking me out of the climate folder as I would only be swapping the files after the process finishes. It's actually the output folder that DNDC is telling me is unwritable due to permissions.

image

ramsaym commented 1 week ago

My issue was running the wrong DNDC. I had run the console version but within its folder so once I read the note in the readme about copying the console exe to the root I was fine. I will see if it will go the next step and inject the climate data. Happy to share any workflows in exchange for time spent here. The pandas DNDC transform is quite flexible for running multiple climate sources through the model with minimal manual overhead. ECCC/AAFC (Tobias et al.) have some interesting high resolution radar based rainfall data that would get down to 1km or better for catching intense rainfall edges and such.

BrianBGrant commented 1 week ago

Glad you were able to resolve the issue Ramsaym! Certainly it'd be interesting to see what you're doing with the model and the high resolution data. I appreciate the offer.

Best,

Brian

ramsaym commented 1 week ago

So far so good with looping using a single .dnd and injecting climate but will have proofs as maps if it actually works. We are using DNDC for a soil carbon credit project but prior to verification and validation using live farm data, I'm trying to generate variation maps and working ranges across varying weather patterns using a subset of cropping sequences, fertility regimes, etc that are most dominant in the ACI data as ell as the specific farm records we have access to. Next I'd like to automate some of the sequencing and generate new dnd files that can be built on soil maps, aci data, etc. Having the solar radiation included from NASA will hopefully give us a clearer picture of how weather extremes are affecting not just cash crops but the cover crops and service crops we are using to build soil carbon from a moisture balance perspective; because we seem to run short as much as we run extra in both space and time here on PEI. A little context if you want I can add you to the repo with the code and it can run from most python/windows ENVs.e.g. WSL works. Cheers, Matt

image

ramsaym commented 1 week ago

had to tweak some code and add a packaging script for GIS, etc. But it appears as though it ran the model on each point correctly. Seeing good distribution in PET, Rainfall, etc. Each spatial point has 24 years of weather data temporally. image