npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

faopm-js

v1.0.1

Published

This is a repository for calculating the FAO-Penman-Monteith equation using JavaScript.

Readme

介绍

该库使用 JavaScript 实现对 FAOPenmanMonteith 高精度的模拟运算 [ Penman Monteith公式 - 维基百科,自由的百科全书 (wikipedia.org) ],目前公式来源基于书籍 作物腾发量 - 作物需水量计算指南 来做理论实现

使用

安装

npm i ,如果您需要将该代码迁移到别处,请使用 npm i mathjs

快速使用

import FAOPenmanMonteith from "xxx/xxx/FAOPenmanMonteith"

const f = new FAOPenmanMonteith({
     temMax: 21.5,
     temMin: 12.3,
     rhMax: 0.84,
     rhMin: 0.63,
     height: 100,
     latitude: 50.8,
     windSpeedAtxm: [10, 2.78],
     actualSunTime: 9.25,
     // windSpeedAt2m: 2.078,
   },
   { precision: 10 }
)
f.start() // 执行计算

API

创建实例

const f = new FAOPenmanMonteith(
	{ ...atmosphereOptions }, 
	{ ...MathConfigOptions }
)

atmosphereOptions

该参数作为第一个参数传入,主要包含气象信息,请参考如下

| key | name | isRequired | others | | --------------- | -------------------------------- | -------------------------------------- | ------------------------------------------------------ | | temMax | 每天的最高气温 | true | | | temMin | 每天的最低气温 | true | | | avgTemPrevMonth | 前一个月的平均气温 | false | | | avgTemCurrMonth | 这个月的平均气温 | false | | | avgTemNextMonth | 去年中这个月的后一个月得平均温度 | false | 比如今年为2024年6月, 那么就需要2023年的5月的数据 | | stationPres | 站点大气压强 | false | 如果存在即可直接使用, 如果没有可以使用站点海拔高度计算 | | latitude | 站点纬度 | true | | | height | 海拔高度 | true | | | rhMax | 相对湿度最大值 | true | | | rhMin | 相对湿度最小值 | true | | | actualSunTime | 实际日照持续时间 | true | | | windSpeedAt2m | 2米高度处的风速 | windSpeedAt2m和windSpeedAtxm必须传一个 | | | windSpeedAtxm | x米高度处的风速 | | [10, 1.2] -> 10米高风速为1.2m/s | | as | as | false | 默认值为0.25 | | bs | bs | false | 默认值为0.5 | | alpha | 反射率或冠层反射系数 | false | 以草为假想的参考作物时,α值为0.23(无量纲) | | timestamp | 时间戳 | | 用于计算日序值, 如果不传入就使用当天时间 |

MathConfigOptions

mathjs 配置,用于实例化 mathjs

参考文档:math.js | an extensive math library for JavaScript and Node.js (mathjs.org)

start

会按照传入的气象数据来计算最终值 参照腾发量

f.start()

getCache

获取缓存的数据

f.getCache()

executeFAOMapping

执行 FAO 映射,faoObj 用于计算的 FAO 对象,isCache 表示该值是否缓存,...args 传入参数

f.executeFAOMapping(faoObj, isCache)(...args)

未来规划

已完成

1、缺少气象数值时存在替补 ET0 计算 (√)

2、补充 TS (√)

3、优化计算过程、参数传递 (√)

待完成

1、目前只写了每日 ET0 计算,还存在很多时间刻度的计算

2、还存在例如 kc、etc 的计算

3、实现自动化测试,给个excel或者其他格式写入数据自动输出数据,并完成报表