@ca-plant-list/ca-plant-list 0.4.38 → 0.4.39

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.
@@ -81,6 +81,15 @@
81
81
  "notineflora": true
82
82
  }
83
83
  },
84
+ "Oenothera deltoides subsp. julpunensis": {
85
+ "comment": "subsp. not yet in Jepson; see data/taxatext for details",
86
+ "calflora": {
87
+ "notintaxondata": true
88
+ },
89
+ "jepson": {
90
+ "notineflora": true
91
+ }
92
+ },
84
93
  "Polypogon interruptus": { "calflora": { "native": true } },
85
94
  "Ranunculus sceleratus var. sceleratus": {
86
95
  "calflora": { "native": false }
package/data/taxa.csv CHANGED
@@ -1332,6 +1332,7 @@ Oenanthe sarmentosa,,N,,,,,34904,5881,60127,205153,,Pacific Oenanthe
1332
1332
  Oenothera biennis,common evening-primrose,X,,,,,34975,5882,62207,26661,true
1333
1333
  Oenothera deltoides subsp. cognata,,N,,,,,51746,5891,80072,43163,true,Birdcage Evening Primrose
1334
1334
  Oenothera deltoides subsp. howellii,Antioch Dunes evening-primrose,N,,,,,51748,5893,80074,43166,true,Antioch Dunes Evening Primrose,,1179,1B.1,CE,FE,S1,G5T1
1335
+ Oenothera deltoides subsp. julpunensis,,N,,,,,,,1631990,438449,,,,5767,1B.1,,,S1,G5T1
1335
1336
  Oenothera elata subsp. hookeri,evening primrose,N,,,,,51752,5897,51814,43171,true,Hooker's Evening Primrose
1336
1337
  Oenothera glazioviana,,X,,,,,35004,5899,62208,26721,true
1337
1338
  Oenothera laciniata,,X,,,,,35016,5900,78243,26747,true
@@ -1838,7 +1839,7 @@ Symphyotrichum lanceolatum var. hesperium,,N,,,,,80306,11093,81407,202308,true,W
1838
1839
  Symphyotrichum lentum,Suisun Marsh aster,N,,,,,80304,9490,60130,211454,true,Suisun Marsh Aster,,289,1B.2,,,S2,G2
1839
1840
  Symphyotrichum spathulatum,,N,,,,,80300,10409,79302,206133,true,Western Mountain Aster
1840
1841
  Symphyotrichum subulatum var. parviflorum,saltmarsh aster,N,annual,"white,pink",7,10,81976,11094,169461,202299,true,Saltmarsh Aster
1841
- Symphyotrichum subulatum var. squamatum,saltmarsh aster,X,annual,white,7,10,93843,,169489,,true
1842
+ Symphyotrichum subulatum var. squamatum,saltmarsh aster,X,annual,white,7,10,93843,12081,169489,207358,true
1842
1843
  Tamarix parviflora,smallflower tamarisk,X,,,,,46074,7916,56011,119759,true,,tamarix-parviflora-plant-profile
1843
1844
  Tamarix ramosissima,saltcedar,X,,,,,46076,7917,56015,119761,true,,tamarix-ramosissima-profile
1844
1845
  Tanacetum parthenium,feverfew,X,,,,,5215,7919,54520,206156,true
@@ -226,7 +226,7 @@ class Taxon extends Taxonomy {
226
226
 
227
227
  getINatName() {
228
228
  const name = this.#iNatSyn ? this.#iNatSyn : this.getName();
229
- return name.replace(/ (subsp|var)\./, "").replace("×", "× ");
229
+ return name.replace(/ (cf|subsp|var)\./, "").replace("×", "× ");
230
230
  }
231
231
 
232
232
  /**
package/lib/tools/rpi.js CHANGED
@@ -4,7 +4,7 @@ import { Files } from "../files.js";
4
4
  import { TaxaCSV } from "./taxacsv.js";
5
5
 
6
6
  /**
7
- * @typedef {"CESA"|"CNDDB"|"FESA"|"Global"} Rank
7
+ * @typedef {"CRPR"|"CESA"|"CNDDB"|"FESA"|"Global"} Rank
8
8
  * @typedef {Map<string,Map<Rank,string|undefined>>} RanksToUpdate
9
9
  */
10
10
 
@@ -166,17 +166,13 @@ export class RPI {
166
166
  }
167
167
  }
168
168
 
169
- if (rank !== taxon.getRPIRankAndThreat()) {
170
- if (taxon.isNative()) {
171
- errorLog.log(
172
- name,
173
- "rank in taxa.csv is different than rank in " +
174
- fileName,
175
- taxon.getRPIRankAndThreat(),
176
- rank,
177
- );
178
- }
179
- }
169
+ checkStatusMatch(
170
+ name,
171
+ "CRPR",
172
+ rank,
173
+ taxon.getRPIRankAndThreat(),
174
+ ranksToUpdate,
175
+ );
180
176
  checkStatusMatch(
181
177
  name,
182
178
  "CESA",
@@ -249,7 +245,7 @@ export class RPI {
249
245
 
250
246
  this.#checkExceptions(taxa, config, exceptions, errorLog);
251
247
 
252
- this.#scrape(toolsDataDir, taxa, exceptions, errorLog);
248
+ this.#scrape(toolsDataDir, dataDir, taxa, exceptions, errorLog, update);
253
249
 
254
250
  if (update) {
255
251
  this.#updateRanks(dataDir, ranksToUpdate);
@@ -421,11 +417,20 @@ export class RPI {
421
417
 
422
418
  /**
423
419
  * @param {string} toolsDataDir
420
+ * @param {string} dataDir
424
421
  * @param {import("../types.js").Taxa} taxa
425
422
  * @param {import("../exceptions.js").Exceptions} exceptions
426
423
  * @param {import("../errorlog.js").ErrorLog} errorLog
424
+ * @param {boolean} update
427
425
  */
428
- static async #scrape(toolsDataDir, taxa, exceptions, errorLog) {
426
+ static async #scrape(
427
+ toolsDataDir,
428
+ dataDir,
429
+ taxa,
430
+ exceptions,
431
+ errorLog,
432
+ update,
433
+ ) {
429
434
  const toolsDataPath = toolsDataDir + "/rpi";
430
435
  const fileName = HTML_FILE_NAME;
431
436
  const filePath = toolsDataPath + "/" + fileName;
@@ -444,6 +449,9 @@ export class RPI {
444
449
  rpiIDs[name] = id;
445
450
  }
446
451
 
452
+ /** @type {Map<string,string>} */
453
+ const idsToUpdate = new Map();
454
+
447
455
  for (const taxon of taxa.getTaxonList()) {
448
456
  if (!taxon.getRPIRankAndThreat()) {
449
457
  continue;
@@ -463,8 +471,13 @@ export class RPI {
463
471
  id,
464
472
  taxon.getRPIID(),
465
473
  );
474
+ idsToUpdate.set(name, id);
466
475
  }
467
476
  }
477
+
478
+ if (update) {
479
+ this.#updateIDs(dataDir, idsToUpdate);
480
+ }
468
481
  }
469
482
 
470
483
  /**
@@ -485,6 +498,24 @@ export class RPI {
485
498
  return false;
486
499
  }
487
500
 
501
+ /**
502
+ * @param {string} dataDir
503
+ * @param {Map<string,string>} idsToUpdate
504
+ */
505
+ static #updateIDs(dataDir, idsToUpdate) {
506
+ const taxa = new TaxaCSV(dataDir);
507
+
508
+ for (const taxonData of taxa.getTaxa()) {
509
+ const id = idsToUpdate.get(taxonData.taxon_name);
510
+ if (!id) {
511
+ continue;
512
+ }
513
+ taxonData["RPI ID"] = id;
514
+ }
515
+
516
+ taxa.write();
517
+ }
518
+
488
519
  /**
489
520
  * @param {string} dataDir
490
521
  * @param {RanksToUpdate} ranksToUpdate
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ca-plant-list/ca-plant-list",
3
- "version": "0.4.38",
3
+ "version": "0.4.39",
4
4
  "description": "Tools to create files for a website listing plants in an area of California.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -47,7 +47,7 @@
47
47
  "image-size": "^2.0.2",
48
48
  "markdown-it": "^14.1.0",
49
49
  "sharp": "^0.34.4",
50
- "svgo-ll": "^6.1.0",
50
+ "svgo-ll": "^6.2.0",
51
51
  "unzipper": "^0.12.3"
52
52
  },
53
53
  "devDependencies": {