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

Try environment conditional formatting #48

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
192 changes: 175 additions & 17 deletions TestGraphs/MakeGraphs/.ipynb_checkpoints/Location-checkpoint.ipynb

Large diffs are not rendered by default.

26 changes: 15 additions & 11 deletions TestGraphs/MakeGraphs/CropStage.ipynb

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion TestGraphs/MakeGraphs/CropStage.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@
root = os.environ["GITHUB_WORKSPACE"]
inPath = os.path.join(root, "TestComponents", "TestSets", "CropStage", "Outputs")
outPath = os.path.join(root, "TestGraphs", "Outputs")
localDayFirst = False
localDateFormat = '%m/%d/%Y %H:%M:%S'
except:
localDayFirst = True
localDateFormat = '%d/%m/%Y %H:%M:%S %p'
rootfrags = os.path.abspath('Location.py').split("\\")
root = ""
for d in rootfrags:
Expand All @@ -71,7 +75,7 @@
# +
Alltests =[]
for t in testFiles[:]:
testframe = pd.read_csv(os.path.join(inPath, t),index_col=0,dayfirst=True,date_format='%d/%m/%Y %H:%M:%S %p')
testframe = pd.read_csv(os.path.join(inPath, t),index_col=0,dayfirst=localDayFirst,date_format=localDateFormat)
Alltests.append(testframe)

AllData = pd.concat(Alltests,axis=1,keys=tests)
Expand Down
48 changes: 33 additions & 15 deletions TestGraphs/MakeGraphs/Location.ipynb

Large diffs are not rendered by default.

9 changes: 7 additions & 2 deletions TestGraphs/MakeGraphs/Location.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# name: python3
# ---

# +
# FieldNBalance is a program that estimates the N balance and provides N fertilizer recommendations for cultivated crops.
# Author: Hamish Brown.
# Copyright (c) 2024 The New Zealand Institute for Plant and Food Research Limited
Expand Down Expand Up @@ -43,8 +44,12 @@
if os.environ["GITHUB_WORKSPACE"] != None:
root = os.environ["GITHUB_WORKSPACE"]
inPath = os.path.join(root, "TestComponents", "TestSets", "Location", "Outputs")
outPath = os.path.join(root, "TestGraphs", "Outputs")
outPath = os.path.join(root, "TestGraphs", "Outputs")
localDayFirst = False
localDateFormat = '%m/%d/%Y %H:%M:%S'
except:
localDayFirst = True
localDateFormat = '%d/%m/%Y %H:%M:%S %p'
rootfrags = os.path.abspath('Location.py').split("\\")
root = ""
for d in rootfrags:
Expand All @@ -69,7 +74,7 @@
# +
Alltests =[]
for t in testFiles[:]:
testframe = pd.read_csv(os.path.join(inPath, t),index_col=0,dayfirst=True,date_format='%d/%m/%Y %H:%M:%S %p')
testframe = pd.read_csv(os.path.join(inPath, t),index_col=0,dayfirst=localDayFirst,date_format=localDateFormat)
Alltests.append(testframe)

AllData = pd.concat(Alltests,axis=1,keys=tests)
Expand Down
24 changes: 14 additions & 10 deletions TestGraphs/MakeGraphs/Losses.ipynb

Large diffs are not rendered by default.

8 changes: 6 additions & 2 deletions TestGraphs/MakeGraphs/Losses.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,12 @@
if os.environ["GITHUB_WORKSPACE"] != None:
root = os.environ["GITHUB_WORKSPACE"]
inPath = os.path.join(root, "TestComponents", "TestSets", "Losses", "Outputs")
outPath = os.path.join(root, "TestGraphs", "Outputs")
outPath = os.path.join(root, "TestGraphs", "Outputs")
localDayFirst = False
localDateFormat = '%m/%d/%Y %H:%M:%S'
except:
localDayFirst = True
localDateFormat = '%d/%m/%Y %H:%M:%S %p'
rootfrags = os.path.abspath('Losses.py').split("\\")
root = ""
for d in rootfrags:
Expand All @@ -70,7 +74,7 @@
# +
Alltests =[]
for t in testFiles[:]:
testframe = pd.read_csv(os.path.join(inPath, t),index_col=0,dayfirst=True,date_format='%d/%m/%Y %H:%M:%S %p')
testframe = pd.read_csv(os.path.join(inPath, t),index_col=0,dayfirst=localDayFirst,date_format=localDateFormat)
Alltests.append(testframe)

AllData = pd.concat(Alltests,axis=1,keys=tests)
Expand Down
21 changes: 13 additions & 8 deletions TestGraphs/MakeGraphs/Moisture.ipynb

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions TestGraphs/MakeGraphs/Moisture.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,11 @@
root = os.environ["GITHUB_WORKSPACE"]
inPath = os.path.join(root, "TestComponents", "TestSets", "Moisture", "Outputs")
outPath = os.path.join(root, "TestGraphs", "Outputs")
dayfirst = False
date_format = '%m/%d/%Y %H:%M:%S %p'
localDayFirst = False
localDateFormat = '%m/%d/%Y %H:%M:%S'
except:
localDayFirst = True
localDateFormat = '%d/%m/%Y %H:%M:%S %p'
rootfrags = os.path.abspath('Moisture.py').split("\\")
root = ""
for d in rootfrags:
Expand All @@ -74,7 +76,7 @@
# +
Alltests =[]
for t in testFiles[:]:
testframe = pd.read_csv(os.path.join(inPath, t),index_col=0,dayfirst=dayfirst,date_format=date_format)
testframe = pd.read_csv(os.path.join(inPath, t),index_col=0,dayfirst=localDayFirst,date_format=localDateFormat)
Alltests.append(testframe)

AllData = pd.concat(Alltests,axis=1,keys=tests)
Expand Down
254 changes: 129 additions & 125 deletions TestGraphs/MakeGraphs/Residues.ipynb

Large diffs are not rendered by default.

8 changes: 6 additions & 2 deletions TestGraphs/MakeGraphs/Residues.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,12 @@
if os.environ["GITHUB_WORKSPACE"] != None:
root = os.environ["GITHUB_WORKSPACE"]
inPath = os.path.join(root, "TestComponents", "TestSets", "Residues", "Outputs")
outPath = os.path.join(root, "TestGraphs", "Outputs")
outPath = os.path.join(root, "TestGraphs", "Outputs")
localDayFirst = False
localDateFormat = '%m/%d/%Y %H:%M:%S'
except:
localDayFirst = True
localDateFormat = '%d/%m/%Y %H:%M:%S %p'
rootfrags = os.path.abspath('Residues.py').split("\\")
root = ""
for d in rootfrags:
Expand All @@ -56,7 +60,7 @@
# +
Alltests =[]
for t in testFiles[:]:
testframe = pd.read_csv(os.path.join(inPath, t),index_col=0,dayfirst=True,date_format='%d/%m/%Y %H:%M:%S %p')
testframe = pd.read_csv(os.path.join(inPath, t),index_col=0,dayfirst=localDayFirst,date_format=localDateFormat)
Alltests.append(testframe)

AllData = pd.concat(Alltests,axis=1,keys=tests)
Expand Down
50 changes: 27 additions & 23 deletions TestGraphs/MakeGraphs/WS1.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 21,
"id": "5d0cd442-4d73-4aaa-90f0-63dd7945be5f",
"metadata": {},
"outputs": [],
Expand All @@ -28,7 +28,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 22,
"id": "9f1dfee6-ad9f-4a0e-8324-31498e929c91",
"metadata": {
"tags": []
Expand All @@ -40,7 +40,11 @@
" root = os.environ[\"GITHUB_WORKSPACE\"]\n",
" inPath = os.path.join(root, \"TestComponents\", \"TestSets\", \"WS1\")\n",
" outPath = os.path.join(root, \"TestGraphs\", \"Outputs\") \n",
" localDayFirst = False\n",
" localDateFormat = '%m/%d/%Y %H:%M:%S'\n",
"except: \n",
" localDayFirst = True\n",
" localDateFormat = '%d/%m/%Y %H:%M:%S %p'\n",
" rootfrags = os.path.abspath('WS1.py').split(\"\\\\\")\n",
" root = \"\"\n",
" for d in rootfrags:\n",
Expand All @@ -54,7 +58,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 23,
"id": "05fb1f35-c392-4a2c-b8ef-283cb8edab2b",
"metadata": {
"tags": []
Expand All @@ -66,7 +70,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 24,
"id": "d59b0fce-0c79-46fb-a0df-85c0c1d6e5bf",
"metadata": {},
"outputs": [],
Expand All @@ -78,7 +82,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 25,
"id": "5ce08860-81d3-4145-b86c-6f7d9d2f5b09",
"metadata": {},
"outputs": [],
Expand All @@ -91,7 +95,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 26,
"id": "acea3a05-e847-42d0-afa6-82245a56da6a",
"metadata": {},
"outputs": [],
Expand All @@ -106,14 +110,14 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 27,
"id": "7f8c350e-5706-4a7f-8215-b4de9b0611a8",
"metadata": {},
"outputs": [],
"source": [
"Alltests =[]\n",
"for t in testFiles[:]: \n",
" testframe = pd.read_csv(os.path.join(inPath, \"Outputs\", t),index_col=0,dayfirst=True,date_format='%d/%m/%Y %H:%M:%S %p') \n",
" testframe = pd.read_csv(os.path.join(inPath, \"Outputs\", t),index_col=0,dayfirst=localDayFirst,date_format=localDateFormat) \n",
" Alltests.append(testframe) \n",
"\n",
"AllData = pd.concat(Alltests,axis=1,keys=tests)\n",
Expand All @@ -123,7 +127,7 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 28,
"id": "6831bdcc-74f0-4aec-8cf4-33f42a53bd3e",
"metadata": {
"tags": []
Expand All @@ -135,7 +139,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 29,
"id": "a1061e31-acfc-4d92-993e-d5652b37d854",
"metadata": {
"tags": []
Expand All @@ -152,7 +156,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 30,
"id": "b809e313",
"metadata": {},
"outputs": [],
Expand All @@ -178,7 +182,7 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": 31,
"id": "7005a019-cef9-416a-93df-632f8ff16abf",
"metadata": {
"tags": []
Expand All @@ -190,7 +194,7 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 32,
"id": "5d27aefa",
"metadata": {
"lines_to_next_cell": 2
Expand Down Expand Up @@ -227,7 +231,7 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": 33,
"id": "c37831a0",
"metadata": {},
"outputs": [
Expand All @@ -237,7 +241,7 @@
"Text(0.5, 0, 'Observed')"
]
},
"execution_count": 13,
"execution_count": 33,
"metadata": {},
"output_type": "execute_result"
},
Expand Down Expand Up @@ -274,7 +278,7 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": 34,
"id": "2adaa765",
"metadata": {},
"outputs": [],
Expand All @@ -300,7 +304,7 @@
},
{
"cell_type": "code",
"execution_count": 15,
"execution_count": 35,
"id": "c5527019",
"metadata": {
"lines_to_next_cell": 2
Expand Down Expand Up @@ -337,7 +341,7 @@
},
{
"cell_type": "code",
"execution_count": 16,
"execution_count": 36,
"id": "2c588eb7",
"metadata": {},
"outputs": [
Expand All @@ -347,7 +351,7 @@
"Text(0.5, 0, 'Observed')"
]
},
"execution_count": 16,
"execution_count": 36,
"metadata": {},
"output_type": "execute_result"
},
Expand Down Expand Up @@ -376,7 +380,7 @@
},
{
"cell_type": "code",
"execution_count": 17,
"execution_count": 37,
"id": "1861c207-3fc4-4a5e-bf97-3841637a4ac1",
"metadata": {
"tags": []
Expand Down Expand Up @@ -408,7 +412,7 @@
},
{
"cell_type": "code",
"execution_count": 18,
"execution_count": 38,
"id": "4bf95856-fee2-4436-bee1-b4d30efbc1e7",
"metadata": {
"tags": []
Expand Down Expand Up @@ -495,7 +499,7 @@
},
{
"cell_type": "code",
"execution_count": 19,
"execution_count": 39,
"id": "7416a649-7c0b-4017-8d3c-a6554e140554",
"metadata": {
"tags": []
Expand All @@ -510,7 +514,7 @@
},
{
"cell_type": "code",
"execution_count": 20,
"execution_count": 40,
"id": "b3cd6247-892e-4ca1-a718-4847303eedc2",
"metadata": {
"tags": []
Expand Down
6 changes: 5 additions & 1 deletion TestGraphs/MakeGraphs/WS1.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@
root = os.environ["GITHUB_WORKSPACE"]
inPath = os.path.join(root, "TestComponents", "TestSets", "WS1")
outPath = os.path.join(root, "TestGraphs", "Outputs")
localDayFirst = False
localDateFormat = '%m/%d/%Y %H:%M:%S'
except:
localDayFirst = True
localDateFormat = '%d/%m/%Y %H:%M:%S %p'
rootfrags = os.path.abspath('WS1.py').split("\\")
root = ""
for d in rootfrags:
Expand Down Expand Up @@ -70,7 +74,7 @@
# +
Alltests =[]
for t in testFiles[:]:
testframe = pd.read_csv(os.path.join(inPath, "Outputs", t),index_col=0,dayfirst=True,date_format='%d/%m/%Y %H:%M:%S %p')
testframe = pd.read_csv(os.path.join(inPath, "Outputs", t),index_col=0,dayfirst=localDayFirst,date_format=localDateFormat)
Alltests.append(testframe)

AllData = pd.concat(Alltests,axis=1,keys=tests)
Expand Down
Loading
Loading