#pragma once
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <netcdf>
#include <cmath>
#include <chrono>
#include <iomanip>
#include "WindDataFileOperator.h"
#include "WindDataOperator_global.h"

LAMPWindDataDLL DataFileInfo get_data_file_info(const std::string& filepath);
LAMPWindDataDLL std::vector<int64_t> get_wind_data_file_time_arr(const std::string& filepath, const DataFileInfo& info);
LAMPWindDataDLL bool read_wind_data_file(const std::string& filepath, const DataFileInfo& info,
    int64_t time_id, std::vector<double>& u_arr, std::vector<double>& v_arr);


class LAMPWindDataDLL ERA5NetCDFConverter {
private:
        
public:
    ERA5NetCDFConverter() = default;
    ~ERA5NetCDFConverter() = default;
    // 处理NetCDF错误
    void handle_netcdf_error(int status, const std::string& operation);
    // 将Unix时间戳转换为ERA5使用的时间格式
    std::vector<double> convert_to_era5_time(const std::vector<int64_t>& unix_timestamps);

    // 创建经纬度坐标数组
    std::vector<double> create_coordinate_array(double min, double max, size_t size);

    bool convert_to_era5_netcdf(const std::string& input_bin_file, const std::string& output_nc_file);
    bool convert_to_era5_netcdf(const std::string& input_bin_file, const std::string& output_nc_file,int64_t tid);
};