我发布的代码计算“i_parent_start”和“j_parent_start”。在Java中,当人们意识到Java没有的功能,比如“minloc”或Python的“unravel_index”。所以我把我的程序分为三个步骤。1。阅读在使用java netcdf xlat_m和xlong_m数组。2。减去预期的纬度和期望经度的每个值二维xlat_m和xlong_m数组和平方的区别。3所示。然后发现指数“我”和“j”最小的二维数组的元素(而不是作为一个扁平的一维数组)。有一个工具,带有WRF叫WRF域创建父进程和子网格的向导,但问题是,你不能看到的地形和土地利用高分辨率模拟至关重要。 In order to view the topography I have another tool that converts the Net*emphasized text*emphasized textCDF file into a KML file and project that on Google Earth. The enclosed image of the child grid is also presented. As explained above for coarse grids this is not so much an issue as it is for nested grids where in the size of the grid itself may not be more than a few hundred meters. ![Location of child grid as superimposed on Google Earth][1] double desiredLatitude = 27; double desiredLongitude = 77; double[][] xlatMArray = getXLatMArray(dataFile); double[][] xlongMArray = getXLongMArray(dataFile); int a = xlatMArray.length; double[][] array = new double[a][a]; for (int i =0 ; i < a;i++) { for (int j =0;j < a ;j++) { double latitudeDiff = desiredLatitude - xlatMArray[i][j]; double longitudeDiff = desiredLongitude - xlongMArray[i][j]; array[i][j]= Math.pow(latitudeDiff,2) + Math.pow(longitudeDiff,2); } } double min = array[0][0]; double max = array[0][0]; int[] minIndex = {0,0}; int[] maxIndex = {0,0}; for (int i =0; i < array.length ; i++) { for (int j =0 ; j < array.length ; j++) { if (array[i][j] < min) { min = array[i][j]; minIndex[0] = i; minIndex[1] = j; } if (array[i][j] > max) { max = array[i][j]; maxIndex[0] = i; maxIndex[1] = j; } } } [1]: http://i.stack.imgur.com/IQ94Q.jpg