当前位置: 首页 > news >正文

编译和使用WPS-ghrsst-to-intermediate生成SST

一、下载

V1.0

https://github.com/bbrashers/WPS-ghrsst-to-intermediate/tree/master

V1.5(使用过程报错,原因不详,能正常使用的麻烦告知一下方法)

https://github.com/dmitryale/WPS-ghrsst-to-intermediate

二、修改makefile

注意:使用什么编译器,那么NETCDF和HDF5也需要使用该编译器编译的版本。
主要修改编译器和NETCDF和HDF5路径

2.1原始文件(PGI)

原始makefile使用PGI编译器编译
在这里插入图片描述

2.2 Gfortran

修改如下

FC      = gfortran
FFLAGS  = -g -std=legacy 
#FFLAGS += -tp=istanbul
FFLAGS += -mcmodel=medium
#FFLAGS += -Kieee                  # use exact IEEE math
#FFLAGS += -Mbounds                # for bounds checking/debugging
#FFLAGS += -Ktrap=fp               # trap floating point exceptions
#FFLAGS += -Bstatic_pgi            # to use static PGI libraries
FFLAGS += -Bstatic                # to use static netCDF libraries
#FFLAGS += -mp=nonuma -nomp        # fix for "can't find libnuma.so"

2.3 Intel

FC      = ifort
FFLAGS  = -g 
FFLAGS += -m64                   # Ensure 64-bit compilation
FFLAGS += -check bounds          # Bounds checking/debugging
# FFLAGS += -fp-model precise    # Use precise floating point model
# FFLAGS += -ftrapuv              # Trap undefined values
FFLAGS += -static-intel          # Use static Intel libraries
# FFLAGS += -Bstatic              # Use static netCDF libraries
FFLAGS += -qopenmp                # Enable OpenMP parallelization

三.编译

make  #生成在自己的路径下
sudo make install  #将生成的ghrsst-to-intermediate复制到/usr/local/bin

四、测试

ghrsst-to-intermediate -h

在这里插入图片描述

五、下载GHRSST数据

使用python进行下载

import os
import requests
from datetime import datetime, timedelta
from urllib.parse import urlparse
import concurrent.futures
import logging
from tqdm import tqdm
from urllib3.util.retry import Retry
from requests.adapters import HTTPAdapterdef setup_logging():logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')def download_file_for_date(custom_date, output_folder):url_template = "https://coastwatch.pfeg.noaa.gov/erddap/files/jplMURSST41/{}090000-JPL-L4_GHRSST-SSTfnd-MUR-GLOB-v02.0-fv04.1.nc"url = url_template.format(custom_date)# 创建年/月文件夹year_folder = os.path.join(output_folder, custom_date[:4])month_folder = os.path.join(year_folder, custom_date[4:6])os.makedirs(month_folder, exist_ok=True)parsed_url = urlparse(url)output_file = os.path.join(month_folder, os.path.basename(parsed_url.path))# 检查文件是否已存在,如果存在则跳过下载if os.path.exists(output_file):logging.info(f"File for {custom_date} already exists. Skipping download.")returntry:session = requests.Session()retry = Retry(total=5, backoff_factor=1, status_forcelist=[429, 500, 502, 503, 504])adapter = HTTPAdapter(max_retries=retry)session.mount('https://', adapter)response = session.get(url, stream=True)response.raise_for_status()  # 检查请求是否成功# 获取文件大小file_size = int(response.headers.get('content-length', 0))# 显示进度条with open(output_file, 'wb') as f, tqdm(desc=f"Downloading {custom_date}", total=file_size,unit="B",unit_scale=True,unit_divisor=1024,dynamic_ncols=True,leave=False) as progress_bar:for data in response.iter_content(chunk_size=1024):f.write(data)progress_bar.update(len(data))logging.info(f"File for {custom_date} downloaded successfully as {output_file}")except requests.exceptions.RequestException as e:logging.error(f"Failed to download file for {custom_date}. {e}")if __name__ == "__main__":setup_logging()# 设置开始和结束日期start_date = datetime(2019, 1, 1)end_date = datetime(2020, 1, 1)# 设置输出文件夹output_folder = ""# 设置线程池大小max_threads = 5# 循环下载文件with concurrent.futures.ThreadPoolExecutor(max_threads) as executor:futures = []current_date = start_datewhile current_date <= end_date:formatted_date = current_date.strftime("%Y%m%d")future = executor.submit(download_file_for_date, formatted_date, output_folder)futures.append(future)current_date += timedelta(days=1)# 等待所有线程完成concurrent.futures.wait(futures)

六、将GHRSST转换为SST文件

import subprocess
from datetime import datetime, timedelta
import os
import shutil
import re
import resourcedef set_stack_size_unlimited():# Set the stack size limit to unlimitedresource.setrlimit(resource.RLIMIT_STACK, (resource.RLIM_INFINITY, resource.RLIM_INFINITY))def process_sst_files(current_date, source_directory):current_day = current_date.strftime("%Y%m%d")year = current_date.strftime("%Y")month = current_date.strftime("%m")# Perform some action for each daycommand = ["ghrsst-to-intermediate","--sst","-g","geo_em.d01.nc",#geo_em.d01.nc文件路径f"{source_directory}/{year}/{month}/{current_day}090000-JPL-L4_GHRSST-SSTfnd-MUR-GLOB-v02.0-fv04.1.nc"]subprocess.run(command)def move_sst_files(source_directory, destination_directory):for filename in os.listdir(source_directory):if filename.startswith("SST"):source_path = os.path.join(source_directory, filename)# Extract year and month from the filename using regular expressionsmatch = re.match(r"SST:(\d{4}-\d{2}-\d{2})_(\d{2})", filename)if match:year, month = match.groups()# Create the destination directory if it doesn't existdestination_year_month_directory = os.path.join(destination_directory, year[:4], month)os.makedirs(destination_year_month_directory, exist_ok=True)# Construct the destination pathdestination_path = os.path.join(destination_year_month_directory, filename)# Move the file to the destination directoryshutil.copyfile(source_path, destination_path)def organize_and_copy_files(SST_path, WPS_path):for root, dirs, files in os.walk(SST_path):for file in files:if 'SST:' in file:origin_file = os.path.join(root, file)for hour in range(1,24,1):#时间间隔调整,跟interval_seconds相同(单位为小时)hour_str = str(hour).rjust(2, '0')copy_file = os.path.join(WPS_path, file.split('_')[0]+'_'+hour_str)if not os.path.exists(copy_file):print(copy_file)shutil.copy(origin_file, copy_file)def main():set_stack_size_unlimited()# Set the start and end dates for the loopstart_date = datetime.strptime("20191231", "%Y%m%d")end_date = datetime.strptime("20200108", "%Y%m%d")source_directory = ""#python代码路径,SST生成在该路径下destination_directory = ""#另存为SST的文件路径WPS_path=""#WPS文件路径#逐一运行ghrsst-to-intermediate,生成当天的SST文件for current_date in (start_date + timedelta(n) for n in range((end_date - start_date).days + 1)):process_sst_files(current_date, source_directory)#将生存的SST文件复制到另外的文件夹中保存move_sst_files(source_directory, destination_directory)#将SST文件按照需要的时间间隔复制organize_and_copy_files(source_directory, WPS_path)if __name__ == "__main__":main()

相关文章:

编译和使用WPS-ghrsst-to-intermediate生成SST

一、下载 V1.0 https://github.com/bbrashers/WPS-ghrsst-to-intermediate/tree/masterV1.5&#xff08;使用过程报错&#xff0c;原因不详&#xff0c;能正常使用的麻烦告知一下方法&#xff09; https://github.com/dmitryale/WPS-ghrsst-to-intermediate二、修改makefile…...

通过静态HTTP实现负载均衡

在当今的互联网环境中&#xff0c;随着用户数量的不断增加和业务需求的不断扩大&#xff0c;单台服务器往往无法承受所有的访问压力。为了确保网站的可用性和性能&#xff0c;负载均衡成为了一种常见的解决方案。本文将探讨如何通过静态HTTP实现负载均衡&#xff0c;以提升网站…...

Python开发运维:Python常见异常类型

目录 一、理论 1.异常 一、理论 1.异常 &#xff08;1&#xff09;概念 异常是程序因为某种原因无法正常工作了&#xff0c;比如缩进错误、缺少软件包、环境 错误、连接超时等都会引发异常。 一个健壮的程序应该把所能预知的异常都应做相应的处理&#xff0c;保障程序长期运…...

HarmonyOS学习 第1节 DevEco Studio配置

俗话说的好&#xff0c;工欲善其事,必先利其器。我们先下载官方的开发工具DevEco Studio. 下载完成后&#xff0c;进行安装。 双击DevEco Studio&#xff0c;点击Next按照指引完成安装 重新启动DevEco&#xff0c;点击 Agree 进入环境配置&#xff0c;安装Node.js和ohpm 点击Ne…...

WordPress 注册/重置密码/更改密码钩子

wordpress在提供邮件提醒的地方都留了hook&#xff0c;方便让开发者自定义。最新在添加第三方登录时遇到虚拟邮箱发信问题&#xff0c;为了防止给指定邮件地址后缀发信&#xff0c;可以利用如下wordpress提供的钩子来实现。 //https://www.wwttl.com/101.html //禁止用户注册时…...

LabVIEW开发远程结构健康监测系统

LabVIEW开发远程结构健康监测系统 工程师依赖于振动监测来评估建筑物、桥梁和其他大型结构的完整性。传统的振动监测工具在数据收集上存在限制&#xff0c;无法长时间收集高保真波形。随着内存存储、处理器速度和宽带无线通信技术的进步&#xff0c;出现了对能够长时间收集并实…...

多段图问题-动态规划解法

一、多段图问题 问题描述&#xff1a;设图G(V, E)是一个带权有向图&#xff0c;如果把顶点集合V划分成k个互不相交的子集Vi (2≤k≤n, 1≤i≤k)&#xff0c;使得对于E中的任何一条边(u, v)&#xff0c;必有u∈Vi&#xff0c;v∈Vim (1≤i≤k, 1&#xff1c;im≤k)&#xff0c;…...

Android实验:绑定service实验

目录 实验目的实验内容实验要求项目结构代码实现代码解释结果展示 实验目的 充分理解Service的作用&#xff0c;与Activity之间的区别&#xff0c;掌握Service的生命周期以及对应函数&#xff0c;了解Service的主线程性质&#xff1b;掌握主线程的界面刷新的设计原则&#xff…...

K8S集群优化的可执行优化

目录 前期环境优化 1.永久关闭交换分区 2.#加载 ip_vs 模块 3.调整内核参数 4.#使用Systemd管理的Cgroup来进行资源控制与管理 5.开机自启kubelet 6.内核参数优化方案 7.etcd优化 默认etcd空间配额大小为 2G&#xff0c;超过 2G 将不再写入数据。通过给etcd配置 --quo…...

Remix IDE 快速开始Starknet

文章目录 一、Remix 项目二、基于Web的开发环境Remix 在线 IDE三、Starknet Remix 插件如何使用使用 Remix【重要】通过 Starknet by Example 学习一、Remix 项目 Remix 项目网站 在以太坊合约开发领域,Remix 项目享有很高的声誉,为各个级别的开发人员提供功能丰富的工具集…...

SQL中limit与分页的结合

select * from test limit 2,10; 这条语句的含义&#xff1a;从第3条语句开始查询&#xff0c;共显示10条语句。 select * from test limit a,b; a0,第一条记录。 a1,第二条记录。 a2,第三条记录。 这条语句的含义&#xff1a;从第a1条语句开始查询&#xff0c;共显示b条…...

KALI LINUX信息收集

预计更新 第一章 入门 1.1 什么是Kali Linux&#xff1f; 1.2 安装Kali Linux 1.3 Kali Linux桌面环境介绍 1.4 基本命令和工具 第二章 信息收集 1.1 网络扫描 1.2 端口扫描 1.3 漏洞扫描 1.4 社交工程学 第三章 攻击和渗透测试 1.1 密码破解 1.2 暴力破解 1.3 漏洞利用 1.4 …...

联想电脑重装系统Win10步骤和详细教程

联想电脑拥有强大的性能&#xff0c;很多用户办公都喜欢用联想电脑。有使用联想电脑的用户反映系统出现问题了&#xff0c;想重新安装一个正常的系统&#xff0c;但是不知道重新系统的具体步骤。接下来小编详细介绍给联想电脑重新安装Win10系统系统的方法步骤。 推荐下载 系统之…...

PET(Point-Query Quadtree for Crowd Counting, Localization, and More)

PET&#xff08;Point-Query Quadtree for Crowd Counting, Localization, and More&#xff09; 介绍实验记录训练阶段推断阶段 介绍 论文&#xff1a;Point-Query Quadtree for Crowd Counting, Localization, and More 实验记录 训练阶段 TODO 推断阶段 下面是以一张输…...

NgRx中dynamic reducer的原理和用法?

在 Angular 应用中&#xff0c;使用 NgRx 状态管理库时&#xff0c;动态 reducer 的概念通常是指在运行时动态添加或移除 reducer。这样的需求可能源于一些特殊的场景&#xff0c;比如按需加载模块时&#xff0c;你可能需要添加相应的 reducer。 以下是动态 reducer 的一般原理…...

麒麟V10服务器安装Apache+PHP

安装PHP yum install php yum install php-curl php-gd php-json php-mbstring php-exif php-mysqlnd php-pgsql php-pdo php-xml 配置文件 /etc/php.ini 修改参数 date.timezone Asia/Shanghai max_execution_time 60 memory_limit 1280M post_max_size 200M file_upload…...

DOS 批处理 (一)

DOS 批处理 1. 批处理是什么&#xff1f;2. DOS和MS-DOS3. 各种操作系统shell的区别Shell 介绍图形用户界面&#xff08;GUI&#xff09;shell命令行界面&#xff08;CLI&#xff09;的 shell命令区别 1. 批处理是什么&#xff1f; 批处理(Batch)&#xff0c;也称为批处理脚本…...

P1047 [NOIP2005 普及组] 校门外的树题解

题目 某校大门外长度为 l 的马路上有一排树&#xff0c;每两棵相邻的树之间的间隔都是1 米。我们可以把马路看成一个数轴&#xff0c;马路的一端在数轴 00 的位置&#xff0c;另一端在l 的位置&#xff1b;数轴上的每个整数点&#xff0c;即0,1,2,…,l&#xff0c;都种有一棵树…...

pip的常用命令

安装、卸载、更新包&#xff1a;pip install [package-name]&#xff0c;pip uninstall [package-name]&#xff0c;pip install --upgrade [package-name]。升级pip&#xff1a;pip install --upgrade pip。查看已安装的包&#xff1a;pip list&#xff0c;pip list --outdate…...

力扣面试题 08.12. 八皇后(java回溯解法)

Problem: 面试题 08.12. 八皇后 文章目录 题目描述思路解题方法复杂度Code 题目描述 思路 八皇后问题的性质可以利用回溯来解决&#xff0c;将大问题具体分解成如下待解决问题&#xff1a; 1.以棋盘的每一行为回溯的决策阶段&#xff0c;判断当前棋盘位置能否放置棋子 2.如何判…...

脑机新手指南(八):OpenBCI_GUI:从环境搭建到数据可视化(下)

一、数据处理与分析实战 &#xff08;一&#xff09;实时滤波与参数调整 基础滤波操作 60Hz 工频滤波&#xff1a;勾选界面右侧 “60Hz” 复选框&#xff0c;可有效抑制电网干扰&#xff08;适用于北美地区&#xff0c;欧洲用户可调整为 50Hz&#xff09;。 平滑处理&…...

centos 7 部署awstats 网站访问检测

一、基础环境准备&#xff08;两种安装方式都要做&#xff09; bash # 安装必要依赖 yum install -y httpd perl mod_perl perl-Time-HiRes perl-DateTime systemctl enable httpd # 设置 Apache 开机自启 systemctl start httpd # 启动 Apache二、安装 AWStats&#xff0…...

页面渲染流程与性能优化

页面渲染流程与性能优化详解&#xff08;完整版&#xff09; 一、现代浏览器渲染流程&#xff08;详细说明&#xff09; 1. 构建DOM树 浏览器接收到HTML文档后&#xff0c;会逐步解析并构建DOM&#xff08;Document Object Model&#xff09;树。具体过程如下&#xff1a; (…...

鸿蒙中用HarmonyOS SDK应用服务 HarmonyOS5开发一个医院查看报告小程序

一、开发环境准备 ​​工具安装​​&#xff1a; 下载安装DevEco Studio 4.0&#xff08;支持HarmonyOS 5&#xff09;配置HarmonyOS SDK 5.0确保Node.js版本≥14 ​​项目初始化​​&#xff1a; ohpm init harmony/hospital-report-app 二、核心功能模块实现 1. 报告列表…...

sqlserver 根据指定字符 解析拼接字符串

DECLARE LotNo NVARCHAR(50)A,B,C DECLARE xml XML ( SELECT <x> REPLACE(LotNo, ,, </x><x>) </x> ) DECLARE ErrorCode NVARCHAR(50) -- 提取 XML 中的值 SELECT value x.value(., VARCHAR(MAX))…...

【Web 进阶篇】优雅的接口设计:统一响应、全局异常处理与参数校验

系列回顾&#xff1a; 在上一篇中&#xff0c;我们成功地为应用集成了数据库&#xff0c;并使用 Spring Data JPA 实现了基本的 CRUD API。我们的应用现在能“记忆”数据了&#xff01;但是&#xff0c;如果你仔细审视那些 API&#xff0c;会发现它们还很“粗糙”&#xff1a;有…...

稳定币的深度剖析与展望

一、引言 在当今数字化浪潮席卷全球的时代&#xff0c;加密货币作为一种新兴的金融现象&#xff0c;正以前所未有的速度改变着我们对传统货币和金融体系的认知。然而&#xff0c;加密货币市场的高度波动性却成为了其广泛应用和普及的一大障碍。在这样的背景下&#xff0c;稳定…...

基于Java Swing的电子通讯录设计与实现:附系统托盘功能代码详解

JAVASQL电子通讯录带系统托盘 一、系统概述 本电子通讯录系统采用Java Swing开发桌面应用&#xff0c;结合SQLite数据库实现联系人管理功能&#xff0c;并集成系统托盘功能提升用户体验。系统支持联系人的增删改查、分组管理、搜索过滤等功能&#xff0c;同时可以最小化到系统…...

【Go语言基础【12】】指针:声明、取地址、解引用

文章目录 零、概述&#xff1a;指针 vs. 引用&#xff08;类比其他语言&#xff09;一、指针基础概念二、指针声明与初始化三、指针操作符1. &&#xff1a;取地址&#xff08;拿到内存地址&#xff09;2. *&#xff1a;解引用&#xff08;拿到值&#xff09; 四、空指针&am…...

Linux 下 DMA 内存映射浅析

序 系统 I/O 设备驱动程序通常调用其特定子系统的接口为 DMA 分配内存&#xff0c;但最终会调到 DMA 子系统的dma_alloc_coherent()/dma_alloc_attrs() 等接口。 关于 dma_alloc_coherent 接口详细的代码讲解、调用流程&#xff0c;可以参考这篇文章&#xff0c;我觉得写的非常…...