Sign inSign up

erfengd/weather

By erfengd

•Updated over 1 year ago

https://github.com/zydp/WeatherInfos

Image
Developer tools
Web servers
2

1.2K

erfengd/weather repository overview

⁠Quick reference

⁠Maintained by:
Dai Ping <[email protected]>

⁠Supported tags

  • latest
  • 1.4

⁠How to use this image

Note: Pulling an images requires using a specific version number tag. The latest tag is default.

⁠Run WeatherInfos:
docker pull erfengd/weather  
//default 
docker run -idt --name WeatherInfos --restart=always -p 3244:3244 erfengd/weather  
//If you want to specify a refresh rate
docker run -idt --name WeatherInfos --restart=always -e -e REFRESH_RATE=30 -p 3244:3244 erfengd/weather  

⁠How to use the WeatherInfos APIs:

 Get services status:                http://ip:port/weather/status
 Get city lists:                     http://ip:port/citylist?city=xx,xx    
 Get weather infos by city name:     http://ip:port/weather?city=xx,xx,xx    
 Obtain weather forecast information for the next 40 days:
                                     http://ip:port/weather/forty?city=shanghai    //省,市,区
 For Test:                           http://ip:port/  
⁠For Example:
Get services status:
    http://serverip:3244/weather/status
Get city lists:
    http://serverip:3244/citylist?city=上海,上海
    http://serverip:3244/citylist?city=黑龙江
    http://serverip:3244/citylist?city=黑龙江,大庆
Get weather infos by city name: 
    http://serverip:3244/weather?city=上海               //省    
    http://serverip:3244/weather?city=上海,上海           //省,市  
    http://serverip:3244/weather?city=上海,上海,松江       //省,市,区 
    http://serverip:3244/weather?city=四川,成都,都江堰     //省,市,区  
    http://serverip:3244/weather/forty?city=shanghai    //省,市,区
Get the next 40 days:
    http://serverip:3244/weather/forty?city=shanghai    //省,市,区
⁠因一些终端设备对中文支持不太友好,因此增加了汉字拼音的支持。
⁠Due to some terminal devices not being very friendly to Chinese language support, support for Chinese Pinyin has been added.
// 城市列表获取
   http://serverip:3244/citylist?city=shanghai,上海          //省,市
   http://serverip:3244/citylist?city=shanghai,shanghai      //省,市
// 天气获取
   http://serverip:3244/weather?city=shanghai                     //省    
   http://serverip:3244/weather?city=shanghai,shanghai            //省,市  
   http://serverip:3244/weather?city=shanghai,上海,songjiang      //省,市,区 
   http://serverip:3244/weather?city=四川,chengdou,都江堰           //省,市,区  

注: 因汉字转拼音采用第三方库,对一些多音字的支持不够完善。
如成都的'都'会被读作'dou',重庆的'重'会被读作'zhong'
因此在使用拼音进查询时,最好使用citylist接口获取到的拼音写法进行调用
Note: Due to the use of third-party libraries for converting Chinese characters to Pinyin, the support for some polyphonic characters is not comprehensive enough. Chengdu's' du 'will be pronounced as' dou', while Chongqing's' zhong 'will be pronounced as' zhong' Therefore, when using pinyin for queries, it is best to use the pinyin format obtained from the citylist interface for calling

⁠返回数据示例(Response Data Example)
{  
    "name": "上海",                          //名称
    "spell": "shanghai,shanghai,shanghai",  //地点拼音
    "updatetime": "11:30",                  //官方7天数据更新时间
    "alarm": true,                          //是否有预警信息
    "servertime": "2024-07-11 15:21:41",    //服务器时间
    "lunar": "甲辰年(龙) 辛未月 甲申日 壬申时",  //干支时间
    "fullname": "上海,上海,上海",             //地点名称
    "nowinfo": {                            //当前天气信息
        "temp": "26.1",                     //温度
        "tempf": "79",                      //华氏温度
        "windirection": "东北风",            //风向
        "windlevel": "1级",                 //风级
        "windspeed": "1km/h",               //风速
        "humidity": "82%",                  //湿速
        "pressure": "1002",                 //大气压
        "visibility": "14km",               //能见度
        "time": "15:05",                    //更新时间
        "aqi": "33",                        //空气质量指数
        "weather": "多云",                   //当前天气
        "date": "07月11日(星期四)"            //更新日期
    },
  "hours": [
        [
            {
                "weather": "阴",                 //天气
                "temp": 32,                     //温度
                "windDirection": "无持续风向",    //风向
                "windLevel": "<3级",             //风级
                "year": 2024,                   //年
                "month": 7,                     //月
                "day": 19,                      //日
                "hour": 8                       //时
            }//共24条,为了写文档方便,这里不全部展示
        ], 
        [
            {
                "weather": "阴",
                "temp": 32,
                "windDirection": "无持续风向",
                "windLevel": "<3级",
                "year": 2024,
                "month": 7,
                "day": 19,
                "hour": 8
            }//共24条,为了写文档方便,这里不全部展示
        ],
        [
            {
                "weather": "阴",             
                "temp": 32,                 
                "windDirection": "无持续风向",   
                "windLevel": "<3级",
                "year": 2024,
                "month": 7,
                "day": 19,
                "hour": 8
            }//共24条,为了写文档方便,这里不全部展示
        ]
    ],  
    "liveindex": [                          //生活指数
        {  
            "name": "感冒指数",              //指数名
            "level": "较易发",               //级别
            "tips": "天凉,湿度大,较易感冒。"  //小贴示
        },  
        {
            "name": "运动指数",
            "level": "较不宜",
            "tips": "有降水,推荐您在室内进行休闲运动。"
        },
        {
            "name": "过敏指数",
            "level": "不易发",
            "tips": "除特殊体质,无需担心过敏问题。"
        },
        {
            "name": "穿衣指数",
            "level": "热",
            "tips": "适合穿T恤、短薄外套等夏季服装。"
        },
        {
            "name": "洗车指数",
            "level": "不宜",
            "tips": "有雨,雨水和泥水会弄脏爱车。"
        },
        {
            "name": "紫外线指数",
            "level": "最弱",
            "tips": "辐射弱,涂擦SPF8-12防晒护肤品。"
        }
    ],
    "weather": [ //7天天气
        {
            "date": "11日(今天)",    //日期
            "sun": "大雨转中雨",       //天气
            "temperature": [         //温度
                24,                  //最低温
                28                   //最高温
            ],
            "wind": {                //风
                "from": "无持续风向",  //来自
                "to": "无持续风向",    //去到
                "level": "<3级"       //风速
            }
        },
        {
            "date": "12日(明天)",
            "sun": "中雨转小雨",
            "temperature": [
                26,
                29
            ],
            "wind": {
                "from": "无持续风向",
                "to": "无持续风向",
                "level": "<3级"
            }
        },
        {
            "date": "13日(后天)",
            "sun": "中雨转小雨",
            "temperature": [
                27,
                30
            ],
            "wind": {
                "from": "无持续风向",
                "to": "无持续风向",
                "level": "<3级"
            }
        },
        {
            "date": "14日(周日)",
            "sun": "小雨转多云",
            "temperature": [
                27,
                31
            ],
            "wind": {
                "from": "无持续风向",
                "to": "无持续风向",
                "level": "<3级"
            }
        },
        {
            "date": "15日(周一)",
            "sun": "阴",
            "temperature": [
                28,
                33
            ],
            "wind": {
                "from": "南风",
                "to": "南风",
                "level": "3-4级"
            }
        },
        {
            "date": "16日(周二)",
            "sun": "阴转多云",
            "temperature": [
                29,
                34
            ],
            "wind": {
                "from": "南风",
                "to": "南风",
                "level": "3-4级"
            }
        },
        {
            "date": "17日(周三)",
            "sun": "阴",
            "temperature": [
                29,
                35
            ],
            "wind": {
                "from": "无持续风向",
                "to": "无持续风向",
                "level": "<3级"
            }
        }
    ],
    "alarminfo": [  //预警信息
        {
            "title": "雷电黄色预警信号",  //预警项
            "details": "上海中心气象台2024年07月11日10时30分发布雷电黄色预警[Ⅲ级/较重]:预计未来24小时内本市大部地区将发生雷电活动,可能会造成雷电灾害事故,并可能伴有小时雨强20-30毫米的短时强降水和7-9级的雷雨大风,请注意防范。(预警信息来源:国家预警信息发布中心)",  //预警详情
            "standard": "6小时内可能发生雷电活动,可能会造成雷电灾害事故。",  //预警标准
            "manual": "1、政府及相关部门按照职责做好防雷工作;2、密切关注天气,尽量避免户外活动。", //防护指南
            "typecode": "09",        //类型名称 tips:可通过type和code获取官网相应图片
            "levelcode": "02",       //级别名称      http://www.weather.com.cn/m2/i/about/alarmpic/0902.gif
            "signaltype": "雷电",     //类型名称
            "signallevel": "黄色",    //级别名称
            "issuetime": "2024-07-11 10:30:00" //预警发布时间
        },
        {
            "title": "暴雨蓝色预警信号",
            "details": "上海中心气象台2024年07月10日19时38分发布暴雨蓝色预警[Ⅳ级/一般]:受较强的降水云团影响,预计今天夜里到明天中午本市大部地区将出现6小时累积降水量达50毫米以上的降水,请注意防范强降雨可能引发的城市积涝,并做好低洼、易受淹地区排水防涝工作。(预警信息来源:国家预警信息发布中心)",
            "standard": "12小时内降雨量将达50毫米以上,或者已达50毫米以上且降雨可能持续。",
            "manual": "1、政府及相关部门按照职责做好防暴雨准备工作;2、学校、幼儿园采取适当措施,保证学生和幼儿安全;3、驾驶人员应当注意道路积水和交通阻塞,确保安全;4、检查城市、农田、鱼塘排水系统,做好排涝准备",
            "typecode": "02",
            "levelcode": "01",
            "signaltype": "暴雨",
            "signallevel": "蓝色",
            "issuetime": "2024-07-10 19:38:00"
        }
    ]
}

//40天预测(实际47天)
[
    {
        "date": "20240719",                 //日戎
        "week": "周五",                      //星期
        "ripe": "嫁娶,结婚,开张……",            //宜
        "avoid": "求官.上任.开张.搬家.探病",     //忌
        "lunar": "六月 十四",                  //农历日期
        "solarTerm": "",                     //节气
        "subSolarTerm": "初伏 第 5 天",        //节气进度
        "festival": "",                      //节日
        "rfestival": "",                     //节日二
        "weather": "多云",                    //天气
        "wcodeOne": "01",                    //天气代码1 可不使用
        "wcodeTwo": "01",                    //天气代码2 可不使用
        "wind": "<3级",                      //风级
        "htemp": "38",                       //最高温
        "mtemp": "29",                       //最低温
        "hmax": "34",                        //历史最高温
        "hmin": "26",                        //历史最低温
        "hrate": "13%",                      //历史降雨概率
        "hrain": ""                           //历史降雨量
    },  
    ... //共47条,为文档方便,不全部展示
}

⁠GitHub
https://github.com/zydp/WeatherInfos

Tag summary

Content type

Image

Digest

sha256:8bd4a4331…

Size

14.2 MB

Last updated

over 1 year ago

docker pull erfengd/weather