頭の体操として、ドキュメントとメーリング リストのアーカイブをしばらく検索しましたが、この集約を処理するために必要な手順をまとめるのに苦労しています。
CFSR 1 時間データ ファイル データはこちらから: http://rda.ucar.edu/datasets/ds094.0/
cdas_20161215_0000_f00000_G4.grib2
cdas_20161215_0000_f00100_G4
cdas_20161215_0000_f00200_G4
cdas_20161215_0000_f00300_G4
etc...
1 時間ごとのファイルは 2 つの時間ディメンションを宣言します。1 つは境界が設定されており、もう 1 つは設定されていません。
cdas_20161215_0000_f00300_G4.grib2
double time(time=1);
:units = "Hour since 2016-12-15T00:00:00Z";
:standard_name = "time";
:long_name = "GRIB forecast or observation time";
:calendar = "proleptic_gregorian";
:bounds = "time_bounds";
double time_bounds(time=1, 2);
:units = "Hour since 2016-12-15T00:00:00Z";
:long_name = "bounds for time";
double time1(time1=1);
:units = "Hour since 2016-12-15T00:00:00Z";
:standard_name = "time";
:long_name = "GRIB forecast or observation time";
:calendar = "proleptic_gregorian";
問題は、データセットを作成するたびに、異なる時間別ファイルが 2 つの時間ディメンション名の名前を交換することです。そのAggregationExisting
ため、たとえば 0300 ファイルの u-component_of_wind_isobaric 変数では、代わりに time1 が宣言されているため、特定のファイルの次元名 'time' を見つけることができません。
私が呼んでいるコード:
List<String> variableNames = Arrays.asList("u-component_of_wind_isobaric","u-component_of_wind_height_above_ground","v-component_of_wind_isobaric","v-component_of_wind_height_above_ground","Pressure_reduced_to_MSL_msl","Geopotential_height_isobaric");
NetcdfDataset netcdfDataset = new NetcdfDataset();
//here i'm trying to aggregate on a dimension called 'time'
AggregationExisting aggregationExisting = new AggregationExisting(netcdfDataset, "time", null);
aggregationExisting.addDatasetScan(null,
"/cfsr-gribs/201612/",
"G4.grib2",
null,
null,
NetcdfDataset.getDefaultEnhanceMode(),
"false",
null);
aggregationExisting.persistWrite();
aggregationExisting.finish(new CancelTaskImpl());
GridDataset gridDataset = new GridDataset(netcdfDataset);
writer.setRedefineMode(true);
CFGridWriter2.writeFile(gridDataset, variableNames, gridDataset.getBoundingBox(), null, 1, null, null, 1, true, writer);
2 つのファイルに示された時間ディメンション名の問題:
//cdas_20161215_0000_f00300_G4.grib2
float u-component_of_wind_isobaric(time1=1, isobaric3=37, lat=361, lon=720);
:long_name = "u-component of wind @ Isobaric surface";
:units = "m/s";
:abbreviation = "UGRD";
:missing_value = NaNf; // float
:grid_mapping = "LatLon_Projection";
:coordinates = "reftime time1 isobaric3 lat lon ";
:Grib_Variable_Id = "VAR_0-2-2_L100";
:Grib2_Parameter = 0, 2, 2; // int
:Grib2_Parameter_Discipline = "Meteorological products";
:Grib2_Parameter_Category = "Momentum";
:Grib2_Parameter_Name = "u-component of wind";
:Grib2_Level_Type = "Isobaric surface";
:Grib2_Generating_Process_Type = "Forecast";
//cdas_20161215_0000_f00200_G4.grib2
float u-component_of_wind_isobaric(time=1, isobaric3=37, lat=361, lon=720);
:long_name = "u-component of wind @ Isobaric surface";
:units = "m/s";
:abbreviation = "UGRD";
:missing_value = NaNf; // float
:grid_mapping = "LatLon_Projection";
:coordinates = "reftime time isobaric3 lat lon ";
:Grib_Variable_Id = "VAR_0-2-2_L100";
:Grib2_Parameter = 0, 2, 2; // int
:Grib2_Parameter_Discipline = "Meteorological products";
:Grib2_Parameter_Category = "Momentum";
:Grib2_Parameter_Name = "u-component of wind";
:Grib2_Level_Type = "Isobaric surface";
:Grib2_Generating_Process_Type = "Forecast";
これは私の最初の NetCDF ライブラリの使用であるため、この癖を持つこれらのデータセットをマージするための前処理ツールを購入しています。たとえば、すべての変数を同じ時間ディメンションに移動して名前を変更できますか? 私が見逃した例へのリンクでも役に立ちます。それ以外の場合は、手動でディメンションを打ち消し、 readDataSlice() を使用してデータを新しいマージされたファイルに手動でコピーすることを検討すると思います。