-
Notifications
You must be signed in to change notification settings - Fork 2
/
a800_04_43_57_Detail.py
594 lines (490 loc) · 29.7 KB
/
a800_04_43_57_Detail.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
'''
Created on Jan 23, 2016
Note:
Revised from a800 04 43 04
Just made Qc same for N and P lim
@author: Keisuke
'''
from pylab import *
from af001_energy_calculation import *
global What_is_limiting
What_is_limiting=1 #0: P-limiting 1:N-limiting
if What_is_limiting==0:
#for P limiting data
from Healey85_data_08_Chl_from_Nlimited_added import healey85C
elif What_is_limiting==1:
#for N limiting data
from Healey85_data_09_Nlimited_case import healey85C
#AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
#Function beging here
#AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
def kkI(healey85data): #this t00function calculate for the same irradiance
I=healey85data.Lightintensity
plotcolor=healey85data.plotcolor
#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
#Parameters
#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
if What_is_limiting==0:
#For P-limiting case
Pin=0.002 #(mol/m3) Phosphorus concentration in the incoming medium (Healey 1985)
Nin=0.2 #(mol/m3) Nitrate concentration in the incoming medium (Healey 1985)
Qc=1.00*10**(-12)/12 #(molC/cell) biomass C per cell (196-18)(from Healey 1985)
elif What_is_limiting==1:
#For N-limiting case
Pin=0.02 #(mol/m3) Phosphorus concentration in the incoming medium (Healey 1985)
Nin=0.05 #(mol/m3) Nitrate concentration in the incoming medium (Healey 1985)
Qc=10**(-12)/12 #(molC/cell) biomass C per cell (196-18)(from Healey 1985)
E3=evalue()
E=E3.E
R=1.63*10**(-6)
h=0.0007174 #used in the next equation
ep3=h #diffusivity of glycolipid layer compared to alginate layer (132-23)
Ra=0 #(dimensionless) the ratio of alginate layer to the cell radius
La=R*Ra #(m) thickness of alginate layer (132-23)
Rg=0.1 #ratio of glycolipid layer to the cell radius
Lg=R*Rg #(m) thickness of glycolipid layer
x0=1/h*(1/R-1/(R+Lg))+ep3/h*1/(R+Lg)+(1/(R+Lg+La))*(1-ep3/h) #effect of
r5=1/(x0*R) #diffusivity efficiency of cell membrane
V=4/3*pi*R**3 #Volume of the cell (m3/cell)
C=6
Ddmax=1.6
#Dmax=4
Dstep=0.001
Dd=arange(Dstep,Ddmax+Dstep,Dstep) #(h-1) growth rate
U=arange(0,Ddmax/Dstep,1)
D=Dd/(3600*24)
#Qc=10**(-12)/12 #(molC/cell) biomass C per cell (196-18)(from Healey 1985)
rho=Qc/V #(molC m-3) biomass C per volume in the cell
Do20=2.12*10**(-9) #Diffusion coefficient of O2 in the water (m2/s)
Do2=Do20*r5 #Diffusion coefficient of O2 in the water (m2/s)
Dch0=6.728*10**(-10) #Diffusion coefficient of glucose in the water (m2/s)
Dch=Dch0*r5 #Diffusion coefficient of glucose in the water (m2/s)
Dnh40=1.98*10**(-9) #Diffusion coefficient of ammonium in the water (m2/s)
Dnh4=Dnh40*r5 #Diffusion coefficient of ammonium in the water (m2/s)
Dno30=1.9*10**(-9) #Diffusion coefficient of nitrate in the water (m2/s) (Li 1974 at 25C)
Dno3=Dnh40*r5 #Diffusion coefficient of nitrate in the water (m2/s)
Dh2po40=8.46*10**(-10) #Diffusion coefficient of H2PO4- in water at 25C (m2 s-1) (Li 1974)
Dhpo40=7.34*10**(-10) #Diffusion coefficient of HPO42- in water at 25C (m2 s-1) (Li 1974)
Dp0=(Dh2po40+Dhpo40)/2 #Take the average as at around Ph 7.5 (healey 1985 paper' initial condition) They exist about half and half
Dp=Dp0*r5 #diffusion coefficient of P through membrane
Mchl=893.49 #(g / mol chlorophyll) mollar mass of chlorophyll
#==============================
#New parameters
#==============================
#------------------------------
#Photosynthesis
#------------------------------
Pmax0=7 #(g C /(g Chl h) Maximum production rate per chlorophyll (around 6 by Cullen 1990)
Pmax=Pmax0*Mchl/12/3600/55 #(mol C s-1 mol chl-1) carbon fixing rate (156-10) (156-15) for unit conversion)
Pmax=0.00320513285659728
OT=0.00863364097132997
Pchl=Pmax*(1-exp(-OT*I)) #(C mol s-1 Chl mol-1) Carbohydrate fixation rate per chlorophyll (167-1)(193-25)
m=5*10**(-19) #(mol C s-1 cell-1) maintenance carbonhydrate consumption (idea from 172-7)
m=3.79146798299876E-19
ls=D*Qc #(molC s-1) Biomass synthesis rate (193-25)
#------------------------------
#OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
#Key parameters: parameterization ideas -> Kei 193-28
#OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
Daverage=0.6*86400
#================================
#Constant parameters
#================================
Ynphoto_chl=3.56099164557551 #((molN cell-1)/(molC chl cell-1)) the stoichiometric ratio for cell photosynthetic enzyme (Rubisco etc.) nitrogen to chlorophyll (193-25)
Ypthylakoid_chl=0.0281633095303638 #((molP cell-1)/(molC chl cell-1)) the shoichiometric ratio for cell phosphorus in thylakoid membrane to chlorophyll (193-26)
Cnproteinsynth=24000 #(s) Constant for protein synthesis nitrogen calculation (193-25)
Cnbiosynth=4.34728279914354E-10 #(molN cell-1 s) Constant for varible part of biosynthesis protein nitrogen (193-37)
Cnrna_variable=6212.59249917364 #(s) Constant for Variable part of RNA (193-26)
Cndna_variable=1.60e-15 #(molN cell-1 s) Constant for variable part of DNA (193-26)
#================================
#================================
#Y intercept parameters
#================================
Nconst_protein=5.4e-15*1.4 #(molN cell-1) Constant protein pool in nitrogen (193-25)
Nconst_protein=4.45336898828389E-15
Nstore_max=2.91679384515998E-15 #(molN cell-1) Constant protein pool in nitrogen (193-25)
Nconst_dnarna=2.78e-15/5/2.8 #(molN cell-1) Constant part of nitrogen in DNA and RNA (193-26)
Nconst_other=2.78e-16 #(molN cell-1) Other kinds of nitrogen assuming constant (193-33)
Pconst_other=5.44534485638617E-17 #(molP cell-1) Constant part of phosphorus (193-26) * This includes ATP ADP, Phospholipid and DNA RNA
#================================
Molar_mass_DNA_AT_average=307.47 #(g mol-1) Molar mass AT average (from "10 Amino acids and nucleic acids stoichiometry.xlsx")
Molar_mass_DNA_CG_average=307.97 #(g mol-1) Molar mass CG average (from "10 Amino acids and nucleic acids stoichiometry.xlsx")
Molar_mass_RNA_AT_average=316.47 #(g mol-1) Molar mass AT average (from "10 Amino acids and nucleic acids stoichiometry.xlsx")
Molar_mass_RNA_CG_average=323.97 #(g mol-1) Molar mass CG average (from "10 Amino acids and nucleic acids stoichiometry.xlsx")
#================================
#E coli
#================================
CG_Ecoli=0.506 #(dimensionless) from [http://www.ncbi.nlm.nih.gov/genome/167 (accessed 06/18/2016)]
AT_Ecoli=1-CG_Ecoli #(dimensionless)
Molar_mass_DNA_Ecoli=Molar_mass_DNA_AT_average*CG_Ecoli+Molar_mass_DNA_CG_average*AT_Ecoli #(g mol-1) Molar mass of DNA unit
Molar_mass_RNA_Ecoli=Molar_mass_RNA_AT_average*CG_Ecoli+Molar_mass_RNA_CG_average*AT_Ecoli #(g mol-1) Molar mass of RNA unit
RNA_DNA_mass_ratio=20/7.6 #(ug/ug) Bremer and Dennis 1996
RNA_DNA_mass_ratio=17.844/6.5239 #(ug/ug) from values ad D=0 "07 Bremer and Dennis 1996 data plot.xlsx"
RNA_DNA_molar_ratio=RNA_DNA_mass_ratio/Molar_mass_RNA_Ecoli*Molar_mass_DNA_Ecoli #(mol mol-1)
#================================
#Stoichiometric parameters
#================================
YcyanoC_N=2 #(molC molN) C/N molar ratio of cyanophycin
YpgC_P=40 #(molC molP) C/P molar ratio of PG: Phosphatidyl glycerol (assuming C16 fatty acids (since actually mostly C16 (Huflejt et al., 1990)
CG=0.563 #GC% [http://www.ncbi.nlm.nih.gov/genome/13522 (accessed 06/18/2016)]
YnucacidP_N=1/(3.5*(1-CG)+4*CG) #(molP molN-1) P/N molar ratio of RNA (193-26) values (193-28) excel file "08 N to P ratio in DNA and RNA.xlsx"
YdnaC_N=3.5*(1-CG)+2.5*CG #(molC molN-1) C/N molar ratio of dna (based on "10 Amino acids and nucleic acids stoichiometry.xlsx)
YrnaC_N=3.25*(1-CG)+2.5*CG #(molC molN-1) C/N molar ratio of rna (based on "10 Amino acids and nucleic acids stoichiometry.xlsx)
DNAmb=2.1269 #(Mb) Megabase pair of synechococcus DNA in mega (million) base pairs [http://www.ncbi.nlm.nih.gov/genome/13522 (accessed 06/18/2016)]
Avogadro=6.022*10**23 #(molecules mol-1) Avogadro constant
Pdna_const=DNAmb*2*10**6/Avogadro #(molP cell-1) Constant part of DNA in phosphorus
Prna_const=Pdna_const*RNA_DNA_molar_ratio #(molP cell-1) Constant part of RNA in phosphorus
#* Make sure to multiply by 2 as they are base PAIRs"
Ndna_const=Pdna_const/YnucacidP_N #(molN cell-1) Constant part of DNA in nitrogen
Nrna_const=Ndna_const*RNA_DNA_molar_ratio #(molN cell-1) Constatn part of RNA in phosphorus
#print(Ndna_const*Avogadro,Nconst_protein*Avogadro)
#YdnaN_P=1/3.75 #(molP molN-1) P/N molar ratio of DNA (193-26) values (193-28) excel file "08 N to P ratio in DNA and RNA.xlsx"
Ynrnaconst_dnarnaconst=1/2 #(dimensionless) N molar ratio of RNA (constant part) to DNA + RNA (constant part) (193-33) reffering to around p.112 of Biology of Prokyariotes
Yndnaconst_dnarnaconst=1-Ynrnaconst_dnarnaconst #(dimensionless) N molar ratio of DNA (constant part) to DNA + RNA (constant part) (193-33) refering to around p.112 of Biology of Prokyariotes
#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
#Calculation
#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Chl=((1+E)*ls+m)/Pchl #(molC chl cell-1) Chlrophyll concentration (193-25)
Nphoto=Chl*Ynphoto_chl #(molN cell-1) Photosynthesis related protein nitrogen (193-25)
Nproteinsynth=(Nphoto+Nconst_protein)*D*Cnproteinsynth/(1-D*Cnproteinsynth) #(molN cell-1) protein synthesis related protein in N (193-25)
Nbiosynth=D*Cnbiosynth #(molN cell-1) various part of biosynthesis related protein in N (193-37)
Nprotein=Nphoto+Nconst_protein+Nbiosynth #(molN cell-1) All the proteins in N (193-26)
Nrna_variable=Nprotein*D*Cnrna_variable #(molN cell-1) variable part of nitrogen in RNA (193-26)(193-37)
Ndna_variable=Ndna_const*Dd/1.2*(18.3-7.6)/7.6 #(molN cell-1) variable part of nitrogen in DNA (193-26) Increasing ratio based on Bremmer 1996
Ndna_variable=0*Dd #(molN cell-1) While Bremer and Dennis shows increasing trend, Parrott 1980 shows decreasing trend.
#print(Dd/1.2*(18.3-7.6)/7.6)
#Ndnarna=Nconst_dnarna+Nnucacid_variable
Nchl=Chl*4/55 #(molN cell-1) Chlorophyll nitrogen (actually almost negligiable)
Pthylakoid=Chl*Ypthylakoid_chl #(molP cel-1) Phosphorus in thylakoid membranes: phospholipid, etc. (193-26)
Prna_variable=Nrna_variable*YnucacidP_N #(molP cell-1) variable part of phosphorus in RNA (193-26)
Pdna_variable=Ndna_variable*YnucacidP_N #(molP cell-1) variable part of phosphorus in DNA (193-26)
#=================================
#Constant part
#=================================
# Nconst_dna=Nconst_dnarna*Yndnaconst_dnarnaconst #(molN cell-1) Constant part of DNA in nitorgen (193-33)
# Nconst_rna=Nconst_dnarna*Ynrnaconst_dnarnaconst #(molN cell-1) Constant part of RNA in nitrogen (193-33)
# Pconst_dna=Nconst_dna*YdnaN_P #(molP cell-1) phosphorus in constant part of DNA (193-33)
# Pconst_rna=Nconst_rna*YrnaN_P #(molP cell-1) phosphorus in constant part of RNA (193-33)
#=================================
#=================================
#Total calculation
#=================================
r2s=0
Qn_max=Nprotein+Nrna_variable+Nrna_const+Ndna_variable+Ndna_const+Nchl+Nstore_max #(molN cell-1) nitrogen content in the cell (193-26) #(molN cell-1) total phosphorus content in the cell (193-26)
Qp_max=25.26/(3.097e16) #(molP cell-1) total phosphorus content in the cell (193-26)
Qn_min=Nprotein+Nrna_variable+Nrna_const+Ndna_variable+Ndna_const+Nchl #(molN cell-1) total nitrogen in the cell without storage
Qp_min=Pconst_other+Pthylakoid+Prna_variable*(1+r2s)+Prna_const*(1+r2s)+Pdna_variable+Pdna_const #(molP cell-1) total phosphorus in the cell without storage
#=================================
#Vector preparation
#=================================
Nstore=zeros(size(Dd))
X=zeros(size(Dd))
Qn_test=zeros(size(Dd))
Qp_test=copy(X)
Qp=copy(X)
Qn=copy(X)
Pstore=copy(X)
#=================================
#Population calculation
#=================================
Xn_max=Nin/Qn_min
Xp_max=Pin/Qp_min
for i in U:
if Xn_max[i]>Xp_max[i]:
X[i]=Xp_max[i]
Qp[i]=Qp_min[i]
Qn_test[i]=Nin/X[i]
Pstore[i]=0
if Qn_test[i]<Qn_max[i]:
Qn[i]=Qn_test[i]
Nstore[i]=Qn_test[i]-Nprotein[i]-Nrna_variable[i]-Nrna_const-Ndna_variable[i]-Ndna_const-Nchl[i] #(molN cell-1) Nitrogen storage in the cell
else:
Qn[i]=Qn_max[i]
Nstore[i]=Nstore_max
else:
X[i]=Xn_max[i]
Qn[i]=Qn_min[i]
Qp_test[i]=Pin/X[i]
if Qp_test[i]<Qp_max:
Qp[i]=Qp_test[i]
else:
Qp[i]=Qp_max
Pstore[i]=Qp[i]-Pconst_other-Pthylakoid[i]-Prna_variable[i]-Prna_const-Pdna_variable[i]-Pdna_const #(molP cell-1) Stored phosphorus in the cell
#X=Pin/Qp #(cells m-3) Number density of cells (193-27)
# x=Nin/Qn #(cells m-3) number density of cells (193-27)
#
#OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
#For plotting 1
#OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
BiomassC=12*X*Qc #(mg C L-1) Biomass concentration
NtoCplot=Qn/Qc*14*10**6/(12*10**3) #(ug N / mg C) biomass N to C ratio (164-20)
PtoCplot=Qp/Qc*30.97*10**6/(12*10**3) #(ug P / mg C) biomass P to C ratio (164-20)
NtoPplot=Qn/Qp*14*10**6/(30.97*10**6) #(ug N /ug P) biomass N to P ratio (164-20)
ChltoC0=Chl/Qc #(mol C chl mol C -1) Chlorophyll to carbon ratio
Mchl=893.49 #(g / mol chlorophyll) mollar mass of chlorophyll
ChltoCplot=ChltoC0/12/1000*Mchl/55*10**6 #(ug chlorophyll a mg C-1) (see 157-36 for conversion)
#OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
#For plotting 2 (calculation of dna, rna, etc)
#OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
# Ndna=Nconst_dna+Ndna_variable #(molN cell-1) nitorgen in DNA (193-33)
# Nrna=Nconst_rna+Nrna_variable #(molN cell-1) nitrogen in RNA (193-33)
# Pdna=Ndna*YdnaN_P #(molP cell-1) phosphorus in DNA (193-33)
# Prna=Nrna*YrnaN_P #(molP cell-1) phosphorus in RNA (193-33)
#Pconst_other=Pconst-Pconst_dna-Pconst_rna #(molP cell-1) phosphorus in other parts (ex. phospholipid in outer membrane, ATP, ADP, etc. (assuming constant) (193-33)
#OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
#For plotting 3 (unit adjustment)
#OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
Nunit=1/Qc#*14*10**6/(12*10**3) #((ug N / mgC)/(molN cell-1) unit conversion term (164-20)
Punit=1/Qc#*30.97*10**6/(12*10**3) #((ug P / mgC)/(molP cell-1) unit conversion term (164-20)
Numbertoarray=ones(size(Dd)) #(dimensionless) Number to array converter
NunitData = 14*10**6/(12*10**3)
PunitData = 30.97*10**6/(12*10**3)
#=======================================
#Calculation of carbon usage (195-16)
#=======================================
CNprotein=4.49 #(molC molN) the ratio of C to N in protein (derived from Brown 1991) calculation in "13 Amino acid composition of different phytoplankton.xlsx"
#-------------------
#C protein
#-------------------
Cphoto=Nphoto*CNprotein #(molC cell-1) carbon in photosystem protein (195-16)
Cbiosynth=Nbiosynth*CNprotein #(molC cell-1) carbon in biosynthesis protein (195-16)
Cconst_protein=Nconst_protein*CNprotein #(molC cell-1) carbon in other protein assumed constant (195-16)
#----------------------
#C chlorophyll
#----------------------
Cchl=Chl #(molC cell-1) carbon in chlorophyll (195-16)
#----------------------
#C DNA RNA
#----------------------
Crna_const=Nrna_const*YrnaC_N #(molC cell-1) carbon in variable part of RNA (195-16)
Crna_variable=Nrna_variable*YrnaC_N #(molC cell-1) carbon in variable part of RNA (195-16)
Cdna_const=Ndna_const*YdnaC_N #(molC cell-1) carbon in constant part of DNA (195-16)
Cdna_variable=Ndna_variable*YdnaC_N #(molC cell-1) carbon in variable part of DNA (195-16)
Cessential=1.51786753491048E-15 #(molC cell-1) essential carbon (lipid membrane, etc.) *8.33e-14/10 is 10%
Cnstore=Nstore*YcyanoC_N #(molC cell-1) carbon in nitrogen storage (cyanophycin)
CthylakoidPG=Pthylakoid*YpgC_P #(molC cell-1) carbon in PG (phosphatidyl glycerol) in thylakoid membranes
#---------------------------------------------------
#C other: Here revised to include Nstore reduction
#---------------------------------------------------
#print(Qc)
Cother_without_Nstore=Qc-Cphoto-Cbiosynth-Cconst_protein-Cchl\
-Crna_const-Crna_variable-Cdna_const-Cdna_variable\
-Cessential-CthylakoidPG
Cother_with_full_Nstore=Qc-Cphoto-Cbiosynth-Cconst_protein-Cchl\
-Crna_const-Crna_variable-Cdna_const-Cdna_variable\
-Cessential-Cnstore-CthylakoidPG
Cother=Cother_with_full_Nstore
Nstore_reduce=logical_and(Cother_without_Nstore>0, Cother_with_full_Nstore<0)
Cnstore[Nstore_reduce]=Cother_without_Nstore[Nstore_reduce]
Nstore0=copy(Nstore)
Nstore[Nstore_reduce]=Cother_without_Nstore[Nstore_reduce]/YcyanoC_N
Cother[Nstore_reduce]=0
Qn[Nstore_reduce]=Qn[Nstore_reduce]+Nstore[Nstore_reduce]-Nstore0[Nstore_reduce]
#OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
#For plotting 1
#OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
BiomassC=12*X*Qc #(mg C L-1) Biomass concentration
NtoCplot=Qn/Qc*14*10**6/(12*10**3) #(ug N / mg C) biomass N to C ratio (164-20)
PtoCplot=Qp/Qc*30.97*10**6/(12*10**3) #(ug P / mg C) biomass P to C ratio (164-20)
NtoPplot=Qn/Qp*14*10**6/(30.97*10**6) #(ug N /ug P) biomass N to P ratio (164-20)
ChltoC0=Chl/Qc #(mol C chl mol C -1) Chlorophyll to carbon ratio
Mchl=893.49 #(g / mol chlorophyll) mollar mass of chlorophyll
ChltoCplot=ChltoC0/12/1000*Mchl/55*10**6 #(ug chlorophyll a mg C-1) (see 157-36 for conversion)
#=======================================
#C for plot in
#=======================================
#*percentorratio=100 #100: percent, 1:ratio
percentorratio=100 #100: percent, 1:ratio
Cphoto_plot=Cphoto/Qc*percentorratio
Cbiosynth_plot=Cbiosynth/Qc*percentorratio
Cconst_protein_plot=Cconst_protein/Qc*percentorratio*Numbertoarray
Cchl_plot=Cchl/Qc*percentorratio
Crna_const_plot=Crna_const/Qc*percentorratio*Numbertoarray
Crna_variable_plot=Crna_variable/Qc*percentorratio
Cdna_const_plot=Cdna_const/Qc*percentorratio*Numbertoarray
Cdna_variable_plot=Cdna_variable/Qc*percentorratio
# Cother_plot=1*percentorratio-Cphoto_plot-Cbiosynth_plot-Cconst_protein_plot-Cchl_plot\
# -Crna_const_plot-Crna_variable_plot-Cdna_const_plot-Cdna_variable_plot
Cother_plot=Cother/Qc*percentorratio
Cessential_plot=Cessential/Qc*percentorratio*Numbertoarray
Cnstore_plot=Cnstore/Qc*percentorratio
CthylakoidPG_plot=CthylakoidPG/Qc*percentorratio
#=======================================
#N for plot ***(Mainly from 193-33)***
#=======================================
Nphoto_plot=Nphoto*Nunit #(ug N/ mgC) Photosynthesis related protein nitrogen (193-25)(193-33)
#Nproteinsynth_plot=Nproteinsynth*Nunit #(ug N/ mgC) protein synthesis related protein in N (193-25)(193-33)
Nbiosynth_plot=Nbiosynth*Nunit #(ug N/ mgC) biosynthesis related protein in N (193-37)
Nconst_protein_plot=Nconst_protein*Nunit*Numbertoarray #(ug N/ mgC) constant protein pool in nitrogen (193-25)(193-33)
# Nrna_plot=Nrna*Nunit #(ug N/ mgC) nitrogen in RNA (193-33)
# Ndna_plot=Ndna*Nunit #(ug N/ mgC) nitrogen in DNA (193-33)
Nchl_plot=Nchl*Nunit #(ug N/ mgC) Chlorophyll nitrogen (actually almost negligiable) (193-33)
# Nconst_other_plot=Nconst_other*Nunit*Numbertoarray #(ug N/ mgC) Other kinds of nitrogen assuming constant (193-33)
Nrna_variable_plot=Nrna_variable*Nunit #(ug N/ mgC) Nitrogen in Variable part of nucleic acid (193-37)
Ndna_variable_plot=Ndna_variable*Nunit #(ug N/ mgC) Nitrogen in Variable part of nucleic acid (193-37)
Ndna_const_plot=Ndna_const*Nunit*Numbertoarray #(ug N/ mgC) Nitrogen in constant part of DNA
Nrna_const_plot=Nrna_const*Nunit*Numbertoarray #(ug N/ mgC) Nitrogen in constant part of RNA
Nstore_plot=Nstore*Nunit #(ug N/ mgC) Nitrogen in storage
#=======================================
#P for plot ***(Mainly from 193-33)***
#=======================================
# Pdna_plot=Pdna*Punit #(ug P/ mgC) phosphorus in DNA (193-33)
# Prna_plot=Prna*Punit #(ug P/ mgC) phosphorus in RNA (193-33)
Prna_variable_plot=Prna_variable*Punit #(ug P/mgC) Phosphorus in variable part of RNA (193-37)
Pdna_variable_plot=Pdna_variable*Punit #(ug P/mgC) Phosphorus in variable part of DNA (193-37)
Pthylakoid_plot=Pthylakoid*Punit #(ug P/ mgC) Phosphorus in thylakoid membranes: phospholipid, etc. (193-26)(193-33)
Pconst_other_plot=Pconst_other*Punit*Numbertoarray #(ug P/ mgC) PHosphorus in other parts (ex. phospholipid in outer membrane, ATP, ADP, etc. (assuming constant) (193-33)
#PtoCplot2=Pdna_plot+Prna_plot+Pthylakoid_plot+Pconst_other_plot #For calculation check
Pdna_const_plot=Pdna_const*Punit*Numbertoarray #(ug P/ mgC) Phosphorus in constant part of DNA
Prna_const_plot=Prna_const*Punit*Numbertoarray #(ug P/ mgC) Phosphorus in constant part of RNA
Pstore_plot=Pstore*Punit #(ug P/ mgC) Phosphorus in phosphorus storage
#OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
#Applying chl max
#OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
#Chlmax=NC0*0.16 #(g chl g C-1) making it a functioni of N to C ratio
Chlmax=0.048
#for i in U:
# if Chlmax*1000 < ChltoCplot[i]: # *1000 is unit converstion from (g chl g C-1) to (ug chl mg C-1)
# BiomassC[i]=nan
# PtoCplot[i]=nan
# NtoCplot[i]=nan
# ChltoCplot[i]=nan
#Dd[Chlmax*1000<ChltoCplot]=nan #this line seems to be causing warning
Dd[Cother<0]=nan
#OOOOOOOOOOOOOOOOOOOOOOOOO
#Print parameters
#OOOOOOOOOOOOOOOOOOOOOOOOO
#OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
#Plot free parameters
#OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
from decimal import Decimal
def sci(Numb):
Numb='%.2E' % Decimal(Numb)
return Numb
print("m",sci(m/Qc*86400))
print("Pmax",sci(Pmax*86400))
print("Apho",sci(OT))
print("Ynphoto_chl",sci(Ynphoto_chl*CNprotein))
print("Abio",sci(Cnbiosynth/86400/Qc*CNprotein))
print("Cother_protein",sci(Nconst_protein/Qc*CNprotein))
print("Arna",sci(Cnrna_variable/CNprotein*YnucacidP_N/86400))
print("Ythylakoid_chl_P",sci(Ypthylakoid_chl))
print("Pconst_other",sci(Pconst_other/Qc))
print("Nstore_max",sci(Nstore_max/Qc))
print("Cessential",sci(Cessential/Qc))
#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
#5.Plot
#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
rcParams.update({'font.size': 25,
'lines.markersize':12,
'lines.markeredgewidth':1})
rcParams.update({'xtick.major.pad': 15})
rcParams.update({'xtick.major.pad': 15})
rcParams.update({'font.serif': 'Times New Roman'})
rcParams.update({'figure.autolayout': True})
rcParams['figure.figsize']=8,6.5
rcParams.update({'figure.facecolor':'W'})
rcParams.update({'lines.linewidth':3})
rcParams.update({'patch.edgecolor':'none'})
rcParams.update({'axes.linewidth':1.5})
rcParams.update({'xtick.major.width':1})
rcParams.update({'ytick.major.width':1})
rcParams.update({'mathtext.default': 'regular' })
lowlim=0
highlim=Ddmax+1e-5
step=0.2
Xmax=1.6000000001
AxisFontSize = 30
DPI = 600
#==================================
#Plot control * 1=on other=off
#==================================
Plot_NC_stack=1
Plot_PC_stack=1
#============================================
#What is limiting: output folder controll
#============================================
if What_is_limiting==0:
Whatislimiting="P-limiting"
elif What_is_limiting==1:
Whatislimiting="N-limiting"
#============================================
if healey85data.i==0:
plotcolor='#4F81BD'
if healey85data.i==1:
plotcolor='#C0504D'
if healey85data.i==2:
plotcolor='#9BBB59'
if healey85data.i==3:
plotcolor='#8064A2'
if healey85data.i==4:
plotcolor='#4BACC6'
#print(BiomassC)
#OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
#Stack plot part
#OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
Color_DNA_const='orange'
Color_RNA_const='yellow'
Color_protein_const='blue'
Color_photo='yellow'
Color_RNA_variable='red'
Color_DNA_variable='blue'
Color_protein_biosynthesis='pink'
Color_chl='#66FF66'
#Color_chl='#207446'
Color_other='#006400'
#Color_other='cyan'
Color_other='#008000'
Color_P_const='#CCFFFF'
Color_DNA='black'
Color_RNA='red'
Color_Nstore='purple'
Color_Pstore='#DDEBF7' #change
Color_Cessential='brown'
Color_thylakoid='#FFD966'
Color_Photo='#FFC000' #change
Color_Bio='#66FF66' #change
Color_Other='#0070C0' #change
Color_Nstore='#FFCCCC'
Color_other='#FFFF99'
StackPlotColorsP=(Color_Other,Color_Photo,'#000000','red',Color_Pstore)
StackPlotColorsN=(Color_Other,Color_Photo,Color_Bio,'#000000','red','#008000',Color_Nstore,Color_other)
FigurenumberN_C=10
if healey85data.i>-1:
if Plot_NC_stack==1:
figure(FigurenumberN_C+healey85data.i)
stackplot(Dd,Nconst_protein_plot,Nphoto_plot,Nbiosynth_plot,Ndna_const_plot+Ndna_variable_plot,Nrna_const_plot+Nrna_variable_plot,Nchl_plot,Nstore_plot,colors=StackPlotColorsN)
plot(healey85data.D_NtoC, healey85data.NtoC/NunitData,'o' ,color='black')
xlabel('$\mu$ (d$^{-1}$)', fontsize=AxisFontSize) #copied from 73
ylabel('mol N mol C$^{-1}$', fontsize=AxisFontSize) #copied from 73
xticks(arange(lowlim,highlim+step,step))
xlim([lowlim,highlim])
First_part="C:\\Users\\keiin\\OneDrive\\Desktop\\figures\\01\\Phytoplankton model\\"+Whatislimiting+"\\Healey85\\N-C detail\\Fig."
Figure_number=str(FigurenumberN_C+healey85data.i)
Last_part=".png"
ylim([0,0.30000001])
xlim(xmax=Xmax)
savefig(First_part+Figure_number+Last_part,dpi=DPI)
FigurenumberP_C=15
if Plot_PC_stack==1:
figure(FigurenumberP_C+healey85data.i)
stackplot(Dd,Pconst_other_plot,Pthylakoid_plot,Pdna_const_plot+Pdna_variable_plot,Prna_variable_plot+Prna_const_plot,Pstore_plot,colors=StackPlotColorsP,edgecolor='none')
plot(healey85data.D_PtoC, healey85data.PtoC/PunitData,'o',color="black")
xlabel('$\mu$ (d$^{-1}$)', fontsize=AxisFontSize) #copied from 73
ylabel('mol P mol C$^{-1}$', fontsize=AxisFontSize) #copied from 73
xticks(arange(lowlim,highlim+step,step))
xlim([lowlim,highlim])
First_part="C:\\Users\\keiin\\OneDrive\\Desktop\\figures\\01\\Phytoplankton model\\"+Whatislimiting+"\\Healey85\\P-C detail\\Fig."
Figure_number=str(FigurenumberP_C+healey85data.i)
Last_part=".png"
if What_is_limiting==0:
ylim([0,0.010])
if What_is_limiting==1:
ylim([0,0.014])
savefig(First_part+Figure_number+Last_part,dpi=DPI)
return
#AAAAAAAAAAAAAAAAAAAAAAAAAAAAA
healey85data=healey85C()
for a in healey85data:
kkI(a)
show()