@ca-plant-list/ca-plant-list 0.4.14 → 0.4.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -736,6 +736,9 @@ Blepharizonia plumosa,89389624,jpg,cc-by-nc,Chloe Novak
736
736
  Boechera breweri subsp. breweri,854971,jpg,cc-by-nc,Robert
737
737
  Bolboschoenus fluviatilis,5421230,jpg,cc-by-nc,sarahaj
738
738
  Bolboschoenus maritimus subsp. paludosus,132800260,jpeg,cc-by-nc,Peter Zika
739
+ Bolboschoenus maritimus subsp. paludosus,132800264,jpeg,cc-by-nc,Peter Zika
740
+ Bolboschoenus maritimus subsp. paludosus,448262257,jpg,cc-by-nc,Fred Melgert / Carla Hoegen
741
+ Bolboschoenus maritimus subsp. paludosus,448262847,jpg,cc-by-nc,Fred Melgert / Carla Hoegen
739
742
  Bolboschoenus robustus,79020136,jpeg,cc-by-nc,Sarah Towne
740
743
  Bowlesia incana,1678991,JPG,cc-by-nc,Carolyn Gritzmaker
741
744
  Bowlesia incana,128744293,jpg,cc-by,Zihao Wang
@@ -964,6 +967,8 @@ Calystegia sepium subsp. limnophila,5091992,jpg,cc-by,Ken-ichi Ueda
964
967
  Calystegia sepium subsp. limnophila,38875324,jpeg,cc-by,Lauren McLaurin
965
968
  Calystegia silvatica subsp. disjuncta,2839177,jpg,cc0,Peter de Lange
966
969
  Calystegia silvatica subsp. disjuncta,2839178,jpg,cc0,Peter de Lange
970
+ Calystegia silvatica subsp. disjuncta,132744682,jpeg,cc-by-nc,lflovesnature
971
+ Calystegia silvatica subsp. disjuncta,132744715,jpeg,cc-by-nc,lflovesnature
967
972
  Calystegia soldanella,106263751,jpg,cc-by-nc,Dani Montijo
968
973
  Calystegia soldanella,16180949,jpeg,cc-by,Arnim Littek
969
974
  Calystegia soldanella,62295020,jpeg,cc0,葉子
@@ -1036,6 +1041,7 @@ Carex barbarae,16259864,jpeg,cc-by,Millie Basden
1036
1041
  Carex barbarae,76197561,jpg,cc-by-nc,jrmorris
1037
1042
  Carex barbarae,9536063,jpeg,cc-by-nc,James Bailey
1038
1043
  Carex brevicaulis,13079255,jpeg,cc-by-nc,Robert Pergl
1044
+ Carex brevicaulis,336177289,jpeg,cc-by,Flavien Saboureau
1039
1045
  Carex comosa,2097792,jpg,cc-by-nc,Susan Elliott
1040
1046
  Carex comosa,2097794,jpg,cc-by-nc,Susan Elliott
1041
1047
  Carex densa,70367090,jpeg,cc-by-nc,James Miskelly
@@ -1598,6 +1604,7 @@ Cryptantha corollata,6694854,jpg,cc-by-nc,Steve Jones
1598
1604
  Cryptantha corollata,6694853,jpg,cc-by-nc,Steve Jones
1599
1605
  Cryptantha flaccida,103049,jpg,cc-by,dloarie
1600
1606
  Cryptantha intermedia var. intermedia,17323919,jpg,cc-by-nc,BJ Stacey
1607
+ Cryptantha intermedia var. intermedia,5699495,jpg,cc-by-nc,Chris Evers
1601
1608
  Cryptantha juniperensis,378730932,jpg,cc-by-nc,madge
1602
1609
  Cryptantha juniperensis,378730814,jpg,cc-by-nc,madge
1603
1610
  Cryptantha juniperensis,38799107,jpeg,cc-by-nc,Conor and Alexandra
@@ -1680,6 +1687,9 @@ Cyperus involucratus,175703429,jpeg,cc-by,Licheng Shih
1680
1687
  Cyperus involucratus,181908056,jpeg,cc-by-nc,Chris Close
1681
1688
  Cyperus involucratus,7928186,jpg,cc-by-nc,LSchare (she/her)
1682
1689
  Cyperus involucratus,55787221,jpeg,cc-by,agujaceratops
1690
+ Cyperus niger,89856671,jpg,cc-by-nc,jrebman
1691
+ Cyperus niger,161421212,jpeg,cc-by,Ken-ichi Ueda
1692
+ Cyperus niger,237485592,jpeg,cc-by,Ken-ichi Ueda
1683
1693
  Cyperus odoratus,24788159,jpeg,cc-by,Zihao Wang
1684
1694
  Cyperus odoratus,25385210,jpg,cc-by-nc,Dan Johnson
1685
1695
  Cyperus strigosus,321391275,jpeg,cc-by,Michael J. Papay
@@ -1752,6 +1762,7 @@ Delphinium californicum subsp. californicum,42625517,jpeg,cc-by-nc,kalibardo
1752
1762
  Delphinium californicum subsp. californicum,42625528,jpeg,cc-by-nc,kalibardo
1753
1763
  Delphinium californicum subsp. californicum,745389,jpg,cc-by-nc,Eric Wrubel
1754
1764
  Delphinium californicum subsp. interius,4087,jpg,cc-by,Ken-ichi Ueda
1765
+ Delphinium californicum subsp. interius,129448412,jpg,cc-by-nc,kevinsherrill
1755
1766
  Delphinium glaucum,37397608,jpg,cc-by-nc,Guy Lemelin
1756
1767
  Delphinium glaucum,3738355,jpg,cc-by,Andrey Zharkikh
1757
1768
  Delphinium gypsophilum,15118,jpg,cc-by,marlin harms
@@ -2247,6 +2258,8 @@ Eriophyllum confertiflorum var. confertiflorum,17035891,jpg,cc-by-nc,Fred Melger
2247
2258
  Eriophyllum confertiflorum var. confertiflorum,42156614,jpg,cc-by-nc,docprt
2248
2259
  Eriophyllum jepsonii,35246132,jpg,cc-by-nc,Christian Schwarz
2249
2260
  Eriophyllum jepsonii,64529857,jpg,cc-by-nc,Chloe and Trevor Van Loon
2261
+ Eriophyllum lanatum var. achilleoides,375544135,jpg,cc-by-nc,Karlyn H. Lewis
2262
+ Eriophyllum lanatum var. achilleoides,62642791,png,cc-by-nc,James Gonsman
2250
2263
  Eriophyllum staechadifolium,171909656,jpg,cc-by,DeeF
2251
2264
  Eriophyllum staechadifolium,2266969,JPG,cc-by,Don Loarie
2252
2265
  Eriophyllum staechadifolium,8009436,jpg,cc-by-nc,Bill Miller
@@ -2350,6 +2363,7 @@ Erythranthe microphylla,121654136,jpg,cc-by-nc,alivea009
2350
2363
  Erythranthe microphylla,127754761,jpeg,cc-by-nc,Dan Tucker
2351
2364
  Erythranthe microphylla,6708076,jpeg,cc-by-nc,Andrew Simon
2352
2365
  Erythranthe microphylla,268075917,jpg,cc-by-nc,Dean Lyons
2366
+ Erythranthe microphylla,373764496,jpg,cc-by-nc,Ocean Fleskes
2353
2367
  Erythranthe moschata,301068789,jpg,cc-by-nc,nathantay
2354
2368
  Erythranthe moschata,305753498,jpg,cc-by-nc,Ocean Fleskes
2355
2369
  Erythranthe moschata,948210,jpg,cc-by-nc,Susan
@@ -3070,6 +3084,9 @@ Juncus xiphioides,9806786,jpg,cc-by-nc,Sarah Wilson
3070
3084
  Juniperus californica,185052,jpg,cc-by,Ken-ichi Ueda
3071
3085
  Juniperus californica,20654,jpg,cc-by,Ken-ichi Ueda
3072
3086
  Juniperus californica,528925,jpg,cc-by-nc,Tom Scott
3087
+ Juniperus communis var. saxatilis,62016689,jpg,cc-by-nc,Boris Bolshakov
3088
+ Juniperus communis var. saxatilis,142708159,jpeg,cc-by-nc,Alexander Rumpel
3089
+ Juniperus communis var. saxatilis,108219672,jpg,cc-by-nc,Felipe Castilla Lattke
3073
3090
  Keckiella breviflora var. breviflora,160934765,jpg,cc-by,Steve Matson
3074
3091
  Keckiella breviflora var. breviflora,160934761,jpg,cc-by,Steve Matson
3075
3092
  Keckiella corymbosa,149319402,jpeg,cc-by-nc,Jason Cantley
@@ -3242,6 +3259,7 @@ Lepidium dictyotum,272680,jpg,cc-by-nc,2009 Zoya Akulova
3242
3259
  Lepidium didymum,175706599,jpeg,cc-by-nc,Aleksandr_Levon
3243
3260
  Lepidium didymum,8011861,jpg,cc0,Jesse Rorabaugh
3244
3261
  Lepidium didymum,114049269,jpeg,cc-by-nc,博甫
3262
+ Lepidium didymum,207927754,jpg,cc-by-nc,Chuangzao
3245
3263
  Lepidium draba,17017121,jpg,cc-by,Conrad Altmann
3246
3264
  Lepidium draba,127389190,jpg,cc-by-nc,africaspotter
3247
3265
  Lepidium draba,34927501,jpg,cc-by-nc,Kayla Echols
@@ -4286,6 +4304,10 @@ Phoradendron leucarpum subsp. macrophyllum,248523345,jpeg,cc-by-nc,James Bailey
4286
4304
  Phoradendron leucarpum subsp. macrophyllum,34637175,jpg,cc-by-nc,jimpark67
4287
4305
  Phoradendron leucarpum subsp. macrophyllum,51724554,jpg,cc-by-nc,ellen hildebrandt
4288
4306
  Phoradendron leucarpum subsp. tomentosum,37764,jpg,cc-by,Franco Folini
4307
+ Phoradendron leucarpum subsp. tomentosum,274597968,jpg,cc-by-nc,Ryan Brooks
4308
+ Phoradendron leucarpum subsp. tomentosum,175973152,jpeg,cc-by-nc,Anne Parsons
4309
+ Phoradendron leucarpum subsp. tomentosum,106352640,jpeg,cc-by-nc,Patricia
4310
+ Phoradendron leucarpum subsp. tomentosum,275717813,jpeg,cc-by,Cricket Raspet
4289
4311
  Phragmites australis,51566082,jpg,cc-by-nc,mimzee
4290
4312
  Phragmites australis,53131602,jpg,cc-by-nc,Sergey Mayorov
4291
4313
  Phragmites australis,57666377,jpeg,cc-by-nc,Roger Debenham
@@ -4760,6 +4782,8 @@ Quercus durata var. durata,22844206,jpg,cc-by,John Rusk
4760
4782
  Quercus garryana var. garryana,1765723,jpg,cc-by-nc,Di
4761
4783
  Quercus garryana var. garryana,132101933,jpg,cc-by,Biodiversity Heritage Library
4762
4784
  Quercus garryana var. garryana,132101934,jpg,cc-by,The Marmot
4785
+ Quercus garryana var. garryana,294381780,jpg,cc-by-nc,JoeJoe Clark
4786
+ Quercus garryana var. garryana,428986606,jpeg,cc-by-nc,Mart Hughes
4763
4787
  Quercus ilex,52702145,jpg,cc-by-nc,Muriel Bendel
4764
4788
  Quercus ilex,165811504,jpeg,cc-by-nc,juristi
4765
4789
  Quercus ilex,243199963,jpeg,cc-by-nc,Platon Kleanthidis
@@ -4834,6 +4858,7 @@ Ranunculus sceleratus,146317741,jpg,cc-by-nc,Vladimir Bryukhov
4834
4858
  Ranunculus sceleratus,31618021,jpg,cc-by-nc,Марина Горбунова-Ëлкина
4835
4859
  Ranunculus sceleratus,17360630,jpeg,cc-by-nc,Nathan Taylor
4836
4860
  Ranunculus sceleratus,74753531,jpeg,cc-by,Nina Filippova
4861
+ Ranunculus sceleratus var. sceleratus,3155996,JPG,cc-by-nc,Bob O'Kennon
4837
4862
  Raphanus raphanistrum,381509992,jpg,cc-by-nc,califorag3r
4838
4863
  Raphanus raphanistrum,79344995,jpeg,cc-by-nc,Nadezhda Nayanova
4839
4864
  Raphanus raphanistrum,284199344,jpg,cc-by-nc,chedar
@@ -5483,6 +5508,8 @@ Spergula arvensis,5060236,jpg,cc-by-nc,Simon Nicholas
5483
5508
  Spergularia bocconi,24556284,jpeg,cc-by-nc,James Bailey
5484
5509
  Spergularia bocconi,112060330,jpeg,cc-by-nc,James Bailey
5485
5510
  Spergularia bocconi,34753827,jpg,cc-by-nc,sue_meiman
5511
+ Spergularia macrotheca var. leucantha,270639696,jpg,cc-by-nc,Bonnie Nickel
5512
+ Spergularia macrotheca var. leucantha,270639736,jpg,cc-by-nc,Bonnie Nickel
5486
5513
  Spergularia macrotheca var. longistyla,183054472,jpg,cc-by-nc,jpgalvan
5487
5514
  Spergularia macrotheca var. longistyla,187421118,jpg,cc-by-nc,chrisdan
5488
5515
  Spergularia macrotheca var. longistyla,186674278,jpg,cc0,Scott Yarger
package/data/taxa.csv CHANGED
@@ -1144,7 +1144,7 @@ Maianthemum racemosum,false Solomon's seal,N,32495,10096,51062,Large False Solom
1144
1144
  Maianthemum stellatum,,N,32497,9629,53268,False Solomon Seal
1145
1145
  Malacothamnus arcuatus var. elmeri,,N,108345,14681,1497404,Eastern Bewildering Bushmallow,perennial,pink,4,5,1065,1B.2,,,S2,G2
1146
1146
  Malacothamnus fremontii var. fremontii,long-haired unfurled bushmallow,N,108341,14689,70398,,perennial,pink,5,6
1147
- Malacothamnus hallii,,N,108345,14681,1497404,,,,,,1065,1B.2,,,S2,G2
1147
+ Malacothamnus hallii,Hall's bushmallow,N,108345,14681,1497404,,perennial,pink,4,5,1065,1B.2,,,S2,G2
1148
1148
  Malacothrix californica,,N,4059,5325,58026,California Desertdandelion
1149
1149
  Malacothrix clevelandii,Cleveland's malacothrix,N,4060,5326,58841,Cleveland's Desertdandelion
1150
1150
  Malacothrix coulteri,snake's-head,N,4061,5327,58027,Snake's Head
@@ -1331,10 +1331,10 @@ Persicaria punctata,,N,37303,11014,78456,Water Smartweed
1331
1331
  Petasites frigidus var. palmatus,coltsfoot,N,8060,6269,55778,Arctic Sweet Coltsfoot
1332
1332
  Petrorhagia dubia,pink grass,X,37370,6275,60602
1333
1333
  Petunia parviflora,wild petunia,N,37378,6279,159650,Seaside Petunia
1334
- Phacelia breweri,,N,37425,6292,68813,Brewer's Phacelia,,blue,3,6
1335
- Phacelia californica,rock phacelia,N,37426,6293,53170,Rock Phacelia
1336
- Phacelia ciliata,great valley phacelia,N,37432,6302,58180,Great Valley Phacelia
1337
- Phacelia distans,"sordid phacelia,distant phacelia",N,37450,6318,56631,Wild Heliotrope,,"white,blue",3,5
1334
+ Phacelia breweri,Brewer's phacelia,N,37425,6292,68813,Brewer's Phacelia,annual,blue,3,6
1335
+ Phacelia californica,rock phacelia,N,37426,6293,53170,Rock Phacelia,perennial,blue,3,9
1336
+ Phacelia ciliata,great valley phacelia,N,37432,6302,58180,Great Valley Phacelia,annual,blue,3,6
1337
+ Phacelia distans,"sordid phacelia,distant phacelia",N,37450,6318,56631,Wild Heliotrope,annual,"white,blue",3,5
1338
1338
  Phacelia divaricata,,N,37451,6319,51093,Divaricate Phacelia
1339
1339
  Phacelia douglasii,,N,37452,6320,58182,Douglas' Phacelia
1340
1340
  Phacelia egena,,N,37455,6322,58183,Kaweah River Phacelia
@@ -0,0 +1,6 @@
1
+ ## Resources
2
+
3
+ - Gowen, David. “[TWO NEW SPECIES OF ERIASTRUM (POLEMONIACEAE) FROM CALIFORNIA.](http://www.jstor.org/stable/24621044)” Journal of the Botanical Research Institute of Texas, vol. 7, no. 1, 2013, pp. 21–24. JSTOR
4
+ - California Department of Fish and Wildlife (CDFW). 2023. [Report to the Fish and Game
5
+ Commission, status review of Lime Ridge eriastrum (_Eriastrum ertterae_)](https://nrm.dfg.ca.gov/FileHandler.ashx?DocumentID=213638&inline). California Department
6
+ of Fish and Wildlife
@@ -0,0 +1,3 @@
1
+ ## Resources
2
+
3
+ - Morse, Keir (2023). [Malacothamnus Volume 3 - A Revised Treatment of the Genus Malacothamnus (Malvaceae) Based on Morphological and Phylogenetic Evidence](https://doi.org/10.6084/m9.figshare.23937066.v1). figshare. Book.
@@ -0,0 +1,3 @@
1
+ ## Resources
2
+
3
+ - Morse, Keir (2023). [Malacothamnus Volume 3 - A Revised Treatment of the Genus Malacothamnus (Malvaceae) Based on Morphological and Phylogenetic Evidence](https://doi.org/10.6084/m9.figshare.23937066.v1). figshare. Book.
@@ -0,0 +1,3 @@
1
+ ## Resources
2
+
3
+ - Morse, Keir (2023). [Malacothamnus Volume 3 - A Revised Treatment of the Genus Malacothamnus (Malvaceae) Based on Morphological and Phylogenetic Evidence](https://doi.org/10.6084/m9.figshare.23937066.v1). figshare. Book.
package/lib/csv.js CHANGED
@@ -6,32 +6,6 @@ import { parse } from "csv-parse";
6
6
  import { stringify } from "csv-stringify/sync";
7
7
 
8
8
  class CSV {
9
- /**
10
- * @param {string} dir
11
- * @param {string} fileName
12
- */
13
- static getMap(dir, fileName) {
14
- /** @type {string[]} */
15
- let headers = [];
16
-
17
- /**
18
- * @param {string[]} h
19
- */
20
- function setHeaders(h) {
21
- headers = h;
22
- return h;
23
- }
24
-
25
- const csv = this.parseFile(dir, fileName, setHeaders);
26
- /** @type {Object<string,string[]>} */
27
- const map = {};
28
- for (const row of csv) {
29
- map[row[headers[0]]] = row[headers[1]];
30
- }
31
-
32
- return map;
33
- }
34
-
35
9
  /**
36
10
  * @param {string} fileName
37
11
  * @param {import("csv-parse").ColumnOption[]|boolean|function (string[]):string[]} columns
@@ -102,6 +76,7 @@ class CSV {
102
76
  * @param {string} fileName
103
77
  * @param {boolean|import("csv-parse").ColumnOption[]|function (string[]):string[]} [columns]
104
78
  * @param {string} [delimiter]
79
+ * @returns {Object<string,string>[]}
105
80
  */
106
81
  static readFile(fileName, columns = true, delimiter) {
107
82
  const content = fs.readFileSync(fileName);
package/lib/exceptions.js CHANGED
@@ -2,7 +2,7 @@ import { Config } from "./config.js";
2
2
  import { Files } from "./files.js";
3
3
 
4
4
  class Exceptions {
5
- /** @type {Object<string,Object<string,Object<string,{}>>>} */
5
+ /** @type {Object<string,Object<string,Object<string,string>>>} */
6
6
  #exceptions = {};
7
7
 
8
8
  /**
@@ -39,6 +39,7 @@ class Exceptions {
39
39
  * @param {string} cat
40
40
  * @param {string} subcat
41
41
  * @param {string} [defaultValue]
42
+ * @returns {string|undefined}
42
43
  */
43
44
  getValue(name, cat, subcat, defaultValue) {
44
45
  const taxonData = this.#exceptions[name];
package/lib/htmltaxon.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { Config } from "./config.js";
1
2
  import { DateUtils } from "./dateutils.js";
2
3
  import { HTML } from "./html.js";
3
4
  import { Markdown } from "./markdown.js";
@@ -127,6 +128,19 @@ class HTMLTaxon {
127
128
  : HTML.wrap("div", parts.join(""), { class: classNames });
128
129
  }
129
130
 
131
+ /**
132
+ * @param {Taxon} taxon
133
+ * @returns {string}
134
+ */
135
+ static getFooterHTML(taxon) {
136
+ const footerTextPath =
137
+ Config.getPackageDir() +
138
+ "/data/text/" +
139
+ taxon.getBaseFileName() +
140
+ ".footer.md";
141
+ return HTMLTaxon.getMarkdownSection(footerTextPath);
142
+ }
143
+
130
144
  /**
131
145
  * @param {Taxon} taxon
132
146
  */
package/lib/index.d.ts CHANGED
@@ -59,6 +59,7 @@ export class HTML {
59
59
  }
60
60
 
61
61
  export class HTMLTaxon {
62
+ static getFooterHTML(taxon: Taxon): string;
62
63
  static getListSectionHTML(
63
64
  list: string[],
64
65
  header: string,
package/lib/program.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { Command } from "commander";
2
2
  import { Files } from "./files.js";
3
3
  import { CSV } from "./csv.js";
4
+ import path from "node:path";
4
5
 
5
6
  class Program {
6
7
  /**
@@ -14,7 +15,10 @@ class Program {
14
15
  console.log(includeFilePath + " not found; loading all taxa");
15
16
  return true;
16
17
  }
17
- const includeCSV = CSV.parseFile(dataDir, includeFileName);
18
+
19
+ /** @type {TaxonData[]} */
20
+ // @ts-ignore
21
+ const includeCSV = CSV.readFile(path.join(dataDir, includeFileName));
18
22
  /** @type {Object<string,TaxonData>} */
19
23
  const include = {};
20
24
  for (const row of includeCSV) {
@@ -29,16 +33,16 @@ class Program {
29
33
  .option(
30
34
  "-d, --datadir <dir>",
31
35
  "The directory containing plant data.",
32
- "./data"
36
+ "./data",
33
37
  )
34
38
  .option(
35
39
  "-f, --show-flower-errors",
36
- "Include missing flower color/flowering time in the error log when loading taxa."
40
+ "Include missing flower color/flowering time in the error log when loading taxa.",
37
41
  )
38
42
  .option(
39
43
  "-o, --outputdir <dir>",
40
44
  "The directory to which output should be written.",
41
- "./output"
45
+ "./output",
42
46
  );
43
47
  return program;
44
48
  }
package/lib/taxa.js CHANGED
@@ -9,6 +9,8 @@ import { Families } from "./families.js";
9
9
  import { FlowerColor } from "./flowercolor.js";
10
10
  import { InatPhoto } from "./inat_photo.js";
11
11
  import { TaxaCSV } from "./tools/taxacsv.js";
12
+ import { ErrorLog } from "./errorlog.js";
13
+ import { Program } from "./program.js";
12
14
 
13
15
  const FLOWER_COLORS = [
14
16
  { name: "white", color: "white" },
@@ -95,6 +97,8 @@ class Taxa {
95
97
  this.#loadInatPhotos(dataDir);
96
98
  }
97
99
 
100
+ /** @type {SynonymData[]} */
101
+ // @ts-ignore
98
102
  const synCSV = CSV.parseFile(dataDir, "synonyms.csv");
99
103
  this.#loadSyns(synCSV, inclusionList);
100
104
  this.#loadSyns(extraSynonyms, inclusionList);
@@ -102,29 +106,57 @@ class Taxa {
102
106
 
103
107
  /**
104
108
  * @param {string} dataDir
109
+ * @param {string} filename
105
110
  */
106
- #loadInatPhotos(dataDir) {
107
- const photosFileName = "inattaxonphotos.csv";
108
- if (fs.existsSync(path.join(dataDir, photosFileName))) {
109
- /** @type {InatCsvPhoto[]} */
110
- const csvPhotos = CSV.parseFile(dataDir, photosFileName);
111
- for (const csvPhoto of csvPhotos) {
112
- const taxon = this.getTaxon(csvPhoto.name);
113
- if (!taxon) {
114
- continue;
115
- }
116
- taxon.addPhoto(
117
- new InatPhoto(
118
- csvPhoto.id,
119
- csvPhoto.ext,
120
- csvPhoto.licenseCode,
121
- csvPhoto.attrName,
122
- ),
123
- );
111
+ #loadPhotosFromFile(dataDir, filename) {
112
+ if (!fs.existsSync(path.join(dataDir, filename))) return;
113
+ /** @type {InatCsvPhoto[]} */
114
+ const csvPhotos = CSV.parseFile(dataDir, filename).map((row) => {
115
+ /** @type {InatLicenseCode} */
116
+ let licenseCode = "cc-by";
117
+ if (row.licenseCode === "cc-by-nc-sa") licenseCode = "cc-by-nc-sa";
118
+ else if (row.licenseCode === "cc-by-nc") licenseCode = "cc-by-nc";
119
+ else if (row.licenseCode === "cc-by-nc-nd")
120
+ licenseCode = "cc-by-nc-nd";
121
+ else if (row.licenseCode === "cc-by") licenseCode = "cc-by";
122
+ else if (row.licenseCode === "cc-by-sa") licenseCode = "cc-by-sa";
123
+ else if (row.licenseCode === "cc-by-nd") licenseCode = "cc-by-nd";
124
+ else if (row.licenseCode === "pd") licenseCode = "pd";
125
+ else if (row.licenseCode === "gdfl") licenseCode = "gdfl";
126
+ else if (row.licenseCode === "cc0") licenseCode = "cc0";
127
+ return {
128
+ attrName: row.attrName,
129
+ ext: row.ext,
130
+ id: Number(row.id),
131
+ licenseCode,
132
+ name: row.name,
133
+ };
134
+ });
135
+ for (const csvPhoto of csvPhotos) {
136
+ const taxon = this.getTaxon(csvPhoto.name);
137
+ if (!taxon) {
138
+ continue;
124
139
  }
140
+ taxon.addPhoto(
141
+ new InatPhoto(
142
+ csvPhoto.id,
143
+ csvPhoto.ext,
144
+ csvPhoto.licenseCode,
145
+ csvPhoto.attrName,
146
+ ),
147
+ );
125
148
  }
126
149
  }
127
150
 
151
+ /**
152
+ * @param {string} dataDir
153
+ */
154
+ #loadInatPhotos(dataDir) {
155
+ this.#loadPhotosFromFile("./data", "inatphotos.csv");
156
+ this.#loadPhotosFromFile(dataDir, "inattaxonphotos.csv");
157
+ this.#loadPhotosFromFile(dataDir, "inatobsphotos.csv");
158
+ }
159
+
128
160
  getFamilies() {
129
161
  return this.#families;
130
162
  }
@@ -161,6 +193,31 @@ class Taxa {
161
193
  return this.#isSubset;
162
194
  }
163
195
 
196
+ /**
197
+ * @param {import("commander").OptionValues} options
198
+ */
199
+ static async loadTaxa(options) {
200
+ const errorLog = new ErrorLog(options.outputdir + "/errors.tsv", false);
201
+
202
+ const loaderPath = "./js/taxaloader.js";
203
+ let taxa;
204
+ if (fs.existsSync(loaderPath)) {
205
+ const taxaLoaderClass = await import(
206
+ "file:" + path.resolve(loaderPath)
207
+ );
208
+ taxa = await taxaLoaderClass.TaxaLoader.loadTaxa(options, errorLog);
209
+ } else {
210
+ taxa = new Taxa(
211
+ Program.getIncludeList(options.datadir),
212
+ errorLog,
213
+ options.showFlowerErrors,
214
+ );
215
+ }
216
+
217
+ errorLog.write();
218
+ return taxa;
219
+ }
220
+
164
221
  /**
165
222
  * @param {SynonymData[]} synCSV
166
223
  * @param {Object<string,TaxonData>|boolean} inclusionList
@@ -194,7 +251,7 @@ class Taxa {
194
251
  for (const row of taxaCSV) {
195
252
  const name = row["taxon_name"];
196
253
 
197
- /** @type {TaxonData|{status?:string}} */
254
+ /** @type {TaxonData|{status?:StatusCode}} */
198
255
  let taxon_overrides = {};
199
256
  if (inclusionList !== true) {
200
257
  taxon_overrides = inclusionList[name];
package/lib/taxon.js CHANGED
@@ -243,6 +243,9 @@ class Taxon {
243
243
  return name.replace(/ (subsp|var)\./, "").replace("×", "× ");
244
244
  }
245
245
 
246
+ /**
247
+ * @returns {string|undefined}
248
+ */
246
249
  getINatSyn() {
247
250
  return this.#iNatSyn;
248
251
  }
@@ -308,13 +311,16 @@ class Taxon {
308
311
  return link;
309
312
  }
310
313
 
314
+ /**
315
+ * @returns {StatusCode}
316
+ */
311
317
  getStatus() {
312
318
  return this.#status;
313
319
  }
314
320
 
315
321
  /**
316
- * @param {*} config
317
- * @returns
322
+ * @param {Config} config
323
+ * @returns {string}
318
324
  */
319
325
  getStatusDescription(config) {
320
326
  switch (this.#status) {
@@ -9,6 +9,7 @@ const CALFLORA_URL_COUNTY =
9
9
 
10
10
  /**
11
11
  * @typedef {{
12
+ * Taxon:string,
12
13
  * "Native Status":string,
13
14
  * TJMTID:string
14
15
  * "Active in Calflora?":string
@@ -59,9 +60,13 @@ class Calflora {
59
60
  calfloraDataFileNameCounties,
60
61
  );
61
62
 
63
+ /** @type {CalfloraData[]} */
64
+ // @ts-ignore
62
65
  const csvActive = CSV.readFile(
63
66
  path.join(toolsDataPath, calfloraDataFileNameActive),
64
67
  );
68
+ /** @type {CalfloraData[]} */
69
+ // @ts-ignore
65
70
  const csvCounties = CSV.readFile(
66
71
  path.join(toolsDataPath, calfloraDataFileNameCounties),
67
72
  );