@ca-plant-list/ca-plant-list 0.4.15 → 0.4.17
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.
- package/README.md +24 -0
- package/data/inatobsphotos.csv +9286 -0
- package/data/inattaxonphotos.csv +27 -0
- package/data/synonyms.csv +2 -0
- package/data/taxa.csv +8 -8
- package/lib/csv.js +1 -26
- package/lib/exceptions.js +2 -1
- package/lib/program.js +8 -4
- package/lib/taxa.js +76 -19
- package/lib/taxon.js +8 -2
- package/lib/tools/calflora.js +5 -0
- package/lib/tools/jepsoneflora.js +440 -0
- package/lib/tools/rpi.js +435 -0
- package/lib/utils/inat-tools.js +4 -4
- package/lib/web/pagetaxon.js +1 -1
- package/package.json +26 -10
- package/scripts/cpl-photos.js +1 -0
- package/scripts/cpl-tools.js +21 -47
- package/scripts/dev/publish.sh +3 -0
- package/scripts/inatobsphotos.js +113 -0
- package/scripts/inattaxonphotos.js +10 -4
- package/types/classes.d.ts +33 -8
- package/.github/workflows/main.yml +0 -20
- package/.prettierrc +0 -3
- package/.vscode/settings.json +0 -9
- package/eslint.config.mjs +0 -13
- package/schemas/exceptions.schema.json +0 -62
- package/tmp/config.json +0 -21
- package/tmp/exceptions.json +0 -93
- package/tmp/families.json +0 -790
- package/tmp/genera.json +0 -5566
- package/tmp/inattaxonphotos.csv +0 -6059
- package/tmp/synonyms.csv +0 -2141
- package/tmp/taxa_include.csv +0 -19
package/data/inattaxonphotos.csv
CHANGED
@@ -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/synonyms.csv
CHANGED
@@ -640,6 +640,7 @@ Elytrigia intermedia,Elymus hispidus
|
|
640
640
|
Elytrigia pontica subsp. pontica,Elymus ponticus
|
641
641
|
Elytrigia pontica,Elymus ponticus
|
642
642
|
Emmenanthe penduliflora var. rosea,Emmenanthe rosea,INAT
|
643
|
+
Emmenanthe rosea,Emmenanthe rosea,INAT
|
643
644
|
Ephedra nevadensis subvar. pluribracteata,Ephedra viridis
|
644
645
|
Ephedra nevadensis var. viridis,Ephedra viridis
|
645
646
|
Epilobium adenocaulon var. holosericeum,Epilobium ciliatum subsp. ciliatum
|
@@ -2022,6 +2023,7 @@ Taxus brevifolia var. reptaneta,Taxus brevifolia
|
|
2022
2023
|
Tetragonia expansa,Tetragonia tetragonoides
|
2023
2024
|
Teutliopsis patula,Atriplex patula
|
2024
2025
|
Thalictrum polycarpum,Thalictrum fendleri var. polycarpum
|
2026
|
+
Thalictrum polycarpum,Thalictrum fendleri var. polycarpum,INAT
|
2025
2027
|
Thelypodium flavescens,Caulanthus flavescens
|
2026
2028
|
Thelypodium lasiophyllum var. inalienum,Caulanthus lasiophyllus
|
2027
2029
|
Thelypodium lasiophyllum var. lasiophyllum,Caulanthus lasiophyllus
|
package/data/taxa.csv
CHANGED
@@ -249,7 +249,7 @@ Bromus madritensis,Spanish brome,X,16263,1207,52707
|
|
249
249
|
Bromus pseudolaevipes,woodland brome,N,16275,1211,75908,Coast Range Brome
|
250
250
|
Bromus racemosus,smooth brome,X,16278,11440,75909
|
251
251
|
Bromus rubens,foxtail chess,X,16281,13634,59210
|
252
|
-
Bromus sitchensis var. carinatus,California brome,N,108589,13623,52700
|
252
|
+
Bromus sitchensis var. carinatus,California brome,N,108589,13623,52700,Sitka Brome
|
253
253
|
Bromus sitchensis var. marginatus,mountain brome,N,108590,13624,159467
|
254
254
|
Bromus sitchensis var. maritimus,maritime brome,N,108591,13625,71142
|
255
255
|
Bromus sterilis,poverty brome,X,16288,1216,57163
|
@@ -644,7 +644,7 @@ Elymus stebbinsii,,N,101964,2944,63331,Stebbins' Wheat Grass
|
|
644
644
|
Elymus trachycaulus subsp. trachycaulus,slender wheatgrass,N,50280,2947,636557,Slender Wheatgrass
|
645
645
|
Elymus triticoides,,N,24181,11648,57184,Creeping Wild Rye
|
646
646
|
Emmenanthe penduliflora,whispering bells,N,24223,2956,58173,Whispering Bells,annual,"white,yellow",4,7
|
647
|
-
Emmenanthe rosea,,N,24224,14564,
|
647
|
+
Emmenanthe rosea,,N,24224,14564,1597339
|
648
648
|
Enemion occidentale,,N,24250,9551,76818,Western Rue-anemone
|
649
649
|
Enemion stipitatum,,N,24252,9552,76819,Siskiyou Rue-anemone
|
650
650
|
Ephedra californica,,N,24275,2972,57890,California Jointfir
|
@@ -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
|
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
|
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
|
@@ -1534,7 +1534,7 @@ Rhamnus crocea,spiny redberry,N,41069,7075,57243,Spiny Redberry
|
|
1534
1534
|
Rhamnus ilicifolia,holly-leaf redberry,N,41070,7076,58308,Hollyleaf Redberry
|
1535
1535
|
Rhaponticum repens,Russian knapweed,X,103802,13621,339502
|
1536
1536
|
Rhinotropis californica,California milkwort,N,107535,14636,876453
|
1537
|
-
Rhus aromatica,skunkbrush,N,41175,11056,58738,
|
1537
|
+
Rhus aromatica,skunkbrush,N,41175,11056,58738,Fragrant Sumac
|
1538
1538
|
Ribes amarum,bitter gooseberry,N,41372,7099,53433,Bitter Gooseberry
|
1539
1539
|
Ribes aureum var. gracillimum,golden currant,N,65126,7104,55547,Golden Currant,perennial,yellow,2,5
|
1540
1540
|
Ribes californicum var. californicum,hillside gooseberry,N,65128,7108,47128,Hillside Gooseberry,perennial,white,2,3
|
@@ -1765,7 +1765,7 @@ Taxus brevifolia,,N,46109,7929,55209,Pacific Yew
|
|
1765
1765
|
Tellima grandiflora,fringe cups,N,46142,7931,51655,Bigflower Tellima
|
1766
1766
|
Tetragonia tetragonoides,New Zealand spinach,X,99693,13131,418653
|
1767
1767
|
Tetrapteron graciliflorum,hill suncup,N,89236,12088,79338,Hill Sun Cup
|
1768
|
-
Thalictrum fendleri var. polycarpum,meadow-rue,N,67038,7951,
|
1768
|
+
Thalictrum fendleri var. polycarpum,meadow-rue,N,67038,7951,1597704,Torrey's Meadow Rue
|
1769
1769
|
Thermopsis californica var. californica,,N,80225,9256,81420,California Goldenbanner,perennial,yellow,5,6
|
1770
1770
|
Thysanocarpus curvipes,fringepod,N,46552,7984,58088,Hairy Lacepod,,white,2,6
|
1771
1771
|
Thysanocarpus laciniatus,lacepod,N,46555,7985,58090,Narrowleaf Fringe Pod,,white,3,5
|
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/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
|
-
|
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
|
-
#
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
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?:
|
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 {
|
317
|
-
* @returns
|
322
|
+
* @param {Config} config
|
323
|
+
* @returns {string}
|
318
324
|
*/
|
319
325
|
getStatusDescription(config) {
|
320
326
|
switch (this.#status) {
|
package/lib/tools/calflora.js
CHANGED
@@ -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
|
);
|