java 解析grib_Java GRIB文件开启

好的,我用NetCDF制作了一些东西 . 对于我的使用它似乎就足够了 . 当然对于每个grib变量都会有所不同 .

try {

NetcdfFile ncf = NetcdfFile.open("gribfilename.grb"); //loading grib file

System.out.println("Variable names are:");

List vars = ncf.getVariables(); //listing variables

for (Variable var : vars) {

System.out.println(var.getName());

}

Variable Uwind = ncf.findVariable("u-component_of_wind_height_above_ground");

Variable Vwind = ncf.findVariable("v-component_of_wind_height_above_ground");

Variable lat = ncf.findVariable("lat");

Variable lon = ncf.findVariable("lon");

Variable time = ncf.findVariable("time");

Variable reftime = ncf.findVariable("reftime");

Variable reftime_ISO = ncf.findVariable("reftime_ISO");

Variable height_above_ground = ncf.findVariable("height_above_ground");

Variable height_above_ground1 = ncf.findVariable("height_above_ground1");

Variable Temperature_height_above_ground = ncf.findVariable("Temperature_height_above_ground");

Variable Pressure_reduced_to_MSL_msl = ncf.findVariable("Pressure_reduced_to_MSL_msl");

Array u_data = Uwind.read(); //reading variables to Array type

Array v_data = Vwind.read();

Array lat_data = lat.read();

Array lon_data = lon.read();

Array time_data = time.read();

Array reftime_data = reftime.read();

Array reftime_ISO_data = reftime_ISO.read();

Array height_above_ground_data = height_above_ground.read();

Array height_above_ground1_data = height_above_ground1.read();

Array Temperature_height_above_ground_data = Temperature_height_above_ground.read();

Array Pressure_reduced_to_MSL_msl_data = Pressure_reduced_to_MSL_msl.read();

ncf.close();

}

catch (Exception exc) {

exc.printStackTrace();

}

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值