Skip to content

Commit

Permalink
fixed some bugs, updates related to location of documents folder
Browse files Browse the repository at this point in the history
  • Loading branch information
ARS-CSGCL-DT committed May 11, 2023
1 parent 785a6df commit 3802807
Show file tree
Hide file tree
Showing 18 changed files with 296 additions and 661 deletions.
6 changes: 1 addition & 5 deletions Classim/CustomTool/createManRepWindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,12 @@
from DatabaseSys.Databasesupport import *
from pprint import pprint

gusername = os.environ['username'] #windows. What about linux
gparent_dir = 'C:\\Users\\'+gusername +'\\Documents'
dbDir = os.path.join(gparent_dir,'classim')

class createManRepWindow(QWidget):
"""
This window is a QWidget.
"""
def __init__(self):
conn, c = openDB(dbDir + '\\crop.db')
conn, c = openDB('crop.db')
if c:
super().__init__()
self.setGeometry(0,0,520,400)
Expand Down
2 changes: 0 additions & 2 deletions Classim/CustomTool/custom1.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
from DatabaseSys.Databasesupport import *
from PyQt5.QtCore import Qt, QModelIndex, QVariant, QAbstractItemModel

# add all the custom listbox, signal and slot cases here
username=os.environ['username']
KEY,NODE = range(2)

@contextmanager
Expand Down
56 changes: 26 additions & 30 deletions Classim/CustomTool/genDictOutput.py

Large diffs are not rendered by default.

35 changes: 11 additions & 24 deletions Classim/CustomTool/generateModelInputFiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import pandas as pd
from CustomTool.custom1 import *
from CustomTool.UI import *
from CustomTool.getClassimDir import *
from DatabaseSys.Databasesupport import *
from Models.cropdata import *
from TabbedDialog.tableWithSignalSlot import *
Expand All @@ -14,30 +15,17 @@
from PyQt5.QtCore import QFile, QTextStream, QIODevice


global runpath1
global app_dir
global repository_dir

gusername = os.environ['username'] #windows. What about linux
gparent_dir = 'C:\\Users\\'+gusername +'\\Documents'
app_dir = os.path.join(gparent_dir,'classim')
if not os.path.exists(app_dir):
os.makedirs(app_dir)

global db
db = app_dir+'\\crop.db'

run_dir = os.path.join(app_dir,'run')
if not os.path.exists(run_dir):
os.makedirs(run_dir)

runpath1= run_dir
repository_dir = os.path.join(runpath1,'store')
global classimDir
global runDir
global storeDir

classimDir = getClassimDir()
runDir = os.path.join(classimDir,'run')
storeDir = os.path.join(runDir,'store')

## This should always be there
if not os.path.exists(repository_dir):
print('RotationTab Error: Missing repository_dir')
if not os.path.exists(storeDir):
print('RotationTab Error: Missing store folder.')


def copyFile(src,dest):
Expand Down Expand Up @@ -329,11 +317,11 @@ def WriteCropVariety(crop,cultivar,field_name,field_path):
fh.close()


def WriteWeather(experiment,treatmentname,stationtype,weather,field_name,field_path,tempVar,rainVar,CO2Var):
def WriteWeather(experiment,treatmentname,stationtype,weather,field_path,tempVar,rainVar,CO2Var):
# First create .wea file that stores the daily/hourly weather information for the simulation period
filename = field_path+'\\'+stationtype + '.wea'
# getting weather data from sqlite
conn, c = openDB(db)
conn, c = openDB('crop.db')

# get date range for treatment
op_date_query = "select distinct odate from operations o, treatment t, experiment e where t.tid = o.o_t_exid and e.exid=t.t_exid and e.name=? and t.name = ?"
Expand Down Expand Up @@ -658,7 +646,6 @@ def WriteMulchGeo(field_path,nutrient):
mulchDecompList = getMulchDecomp(nutrient)

CODEC="UTF-8"
#field_path = os.path.join(runpath1,field_name)
filename = field_path+'\\MulchGeo.mul'
fh = QFile(filename)

Expand Down
Binary file removed Classim/CustomTool/textureclass64.dll
Binary file not shown.
Loading

0 comments on commit 3802807

Please sign in to comment.