diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 4dac520ed..788358aba 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -38,7 +38,7 @@ jobs: - bash: | eval "$(conda shell.bash hook)" conda activate build - conda build -m "conda_package/ci/linux_python${PYTHON_VERSION}.yaml" "conda_package/recipe" + conda build -m "conda_package/ci/linux_64_python${PYTHON_VERSION}.____cpython.yaml" "conda_package/recipe" displayName: Build MPAS-Tools - bash: | @@ -158,7 +158,7 @@ jobs: - bash: | eval "$(conda shell.bash hook)" conda activate build - conda build -m "conda_package/ci/osx_python${PYTHON_VERSION}.yaml" "conda_package/recipe" + conda build -m "conda_package/ci/osx_64_python${PYTHON_VERSION}.____cpython.yaml" "conda_package/recipe" displayName: Build MPAS-Tools - bash: | diff --git a/conda_package/ci/linux_python3.10.yaml b/conda_package/ci/linux_64_python3.10.____cpython.yaml similarity index 98% rename from conda_package/ci/linux_python3.10.yaml rename to conda_package/ci/linux_64_python3.10.____cpython.yaml index 2fa257cee..de2c8f384 100644 --- a/conda_package/ci/linux_python3.10.yaml +++ b/conda_package/ci/linux_64_python3.10.____cpython.yaml @@ -15,7 +15,7 @@ fortran_compiler: fortran_compiler_version: - '12' hdf5: -- 1.14.2 +- 1.14.3 libnetcdf: - 4.9.2 netcdf_fortran: diff --git a/conda_package/ci/linux_python3.11.yaml b/conda_package/ci/linux_64_python3.11.____cpython.yaml similarity index 98% rename from conda_package/ci/linux_python3.11.yaml rename to conda_package/ci/linux_64_python3.11.____cpython.yaml index bb5761d64..b973d3ff8 100644 --- a/conda_package/ci/linux_python3.11.yaml +++ b/conda_package/ci/linux_64_python3.11.____cpython.yaml @@ -15,7 +15,7 @@ fortran_compiler: fortran_compiler_version: - '12' hdf5: -- 1.14.2 +- 1.14.3 libnetcdf: - 4.9.2 netcdf_fortran: diff --git a/conda_package/ci/linux_64_python3.12.____cpython.yaml b/conda_package/ci/linux_64_python3.12.____cpython.yaml new file mode 100644 index 000000000..4b8de5dc8 --- /dev/null +++ b/conda_package/ci/linux_64_python3.12.____cpython.yaml @@ -0,0 +1,33 @@ +cdt_name: +- cos6 +channel_sources: +- conda-forge +channel_targets: +- conda-forge main +cxx_compiler: +- gxx +cxx_compiler_version: +- '12' +docker_image: +- quay.io/condaforge/linux-anvil-cos7-x86_64 +fortran_compiler: +- gfortran +fortran_compiler_version: +- '12' +hdf5: +- 1.14.3 +libnetcdf: +- 4.9.2 +netcdf_fortran: +- '4.6' +pin_run_as_build: + python: + min_pin: x.x + max_pin: x.x +python: +- 3.12.* *_cpython +target_platform: +- linux-64 +zip_keys: +- - cxx_compiler_version + - fortran_compiler_version diff --git a/conda_package/ci/linux_64_python3.8.____cpython.yaml b/conda_package/ci/linux_64_python3.8.____cpython.yaml new file mode 100644 index 000000000..69ab4bef7 --- /dev/null +++ b/conda_package/ci/linux_64_python3.8.____cpython.yaml @@ -0,0 +1,33 @@ +cdt_name: +- cos6 +channel_sources: +- conda-forge +channel_targets: +- conda-forge main +cxx_compiler: +- gxx +cxx_compiler_version: +- '12' +docker_image: +- quay.io/condaforge/linux-anvil-cos7-x86_64 +fortran_compiler: +- gfortran +fortran_compiler_version: +- '12' +hdf5: +- 1.14.3 +libnetcdf: +- 4.9.2 +netcdf_fortran: +- '4.6' +pin_run_as_build: + python: + min_pin: x.x + max_pin: x.x +python: +- 3.8.* *_cpython +target_platform: +- linux-64 +zip_keys: +- - cxx_compiler_version + - fortran_compiler_version diff --git a/conda_package/ci/linux_python3.9.yaml b/conda_package/ci/linux_64_python3.9.____cpython.yaml similarity index 98% rename from conda_package/ci/linux_python3.9.yaml rename to conda_package/ci/linux_64_python3.9.____cpython.yaml index 03c939c7a..e7cff6d40 100644 --- a/conda_package/ci/linux_python3.9.yaml +++ b/conda_package/ci/linux_64_python3.9.____cpython.yaml @@ -15,7 +15,7 @@ fortran_compiler: fortran_compiler_version: - '12' hdf5: -- 1.14.2 +- 1.14.3 libnetcdf: - 4.9.2 netcdf_fortran: diff --git a/conda_package/ci/osx_python3.10.yaml b/conda_package/ci/osx_64_python3.10.____cpython.yaml similarity index 95% rename from conda_package/ci/osx_python3.10.yaml rename to conda_package/ci/osx_64_python3.10.____cpython.yaml index 37e52bc37..ade8240bb 100644 --- a/conda_package/ci/osx_python3.10.yaml +++ b/conda_package/ci/osx_64_python3.10.____cpython.yaml @@ -7,17 +7,17 @@ channel_targets: cxx_compiler: - clangxx cxx_compiler_version: -- '15' +- '16' fortran_compiler: - gfortran fortran_compiler_version: - '12' hdf5: -- 1.14.2 +- 1.14.3 libnetcdf: - 4.9.2 llvm_openmp: -- '15' +- '16' macos_machine: - x86_64-apple-darwin13.4.0 netcdf_fortran: diff --git a/conda_package/ci/osx_python3.11.yaml b/conda_package/ci/osx_64_python3.11.____cpython.yaml similarity index 95% rename from conda_package/ci/osx_python3.11.yaml rename to conda_package/ci/osx_64_python3.11.____cpython.yaml index a1ce0cbb3..248ca3347 100644 --- a/conda_package/ci/osx_python3.11.yaml +++ b/conda_package/ci/osx_64_python3.11.____cpython.yaml @@ -7,17 +7,17 @@ channel_targets: cxx_compiler: - clangxx cxx_compiler_version: -- '15' +- '16' fortran_compiler: - gfortran fortran_compiler_version: - '12' hdf5: -- 1.14.2 +- 1.14.3 libnetcdf: - 4.9.2 llvm_openmp: -- '15' +- '16' macos_machine: - x86_64-apple-darwin13.4.0 netcdf_fortran: diff --git a/conda_package/ci/osx_64_python3.12.____cpython.yaml b/conda_package/ci/osx_64_python3.12.____cpython.yaml new file mode 100644 index 000000000..f4b5c65a5 --- /dev/null +++ b/conda_package/ci/osx_64_python3.12.____cpython.yaml @@ -0,0 +1,35 @@ +MACOSX_DEPLOYMENT_TARGET: +- '10.9' +channel_sources: +- conda-forge +channel_targets: +- conda-forge main +cxx_compiler: +- clangxx +cxx_compiler_version: +- '16' +fortran_compiler: +- gfortran +fortran_compiler_version: +- '12' +hdf5: +- 1.14.3 +libnetcdf: +- 4.9.2 +llvm_openmp: +- '16' +macos_machine: +- x86_64-apple-darwin13.4.0 +netcdf_fortran: +- '4.6' +pin_run_as_build: + python: + min_pin: x.x + max_pin: x.x +python: +- 3.12.* *_cpython +target_platform: +- osx-64 +zip_keys: +- - cxx_compiler_version + - fortran_compiler_version diff --git a/conda_package/ci/osx_64_python3.8.____cpython.yaml b/conda_package/ci/osx_64_python3.8.____cpython.yaml new file mode 100644 index 000000000..0798779bb --- /dev/null +++ b/conda_package/ci/osx_64_python3.8.____cpython.yaml @@ -0,0 +1,35 @@ +MACOSX_DEPLOYMENT_TARGET: +- '10.9' +channel_sources: +- conda-forge +channel_targets: +- conda-forge main +cxx_compiler: +- clangxx +cxx_compiler_version: +- '16' +fortran_compiler: +- gfortran +fortran_compiler_version: +- '12' +hdf5: +- 1.14.3 +libnetcdf: +- 4.9.2 +llvm_openmp: +- '16' +macos_machine: +- x86_64-apple-darwin13.4.0 +netcdf_fortran: +- '4.6' +pin_run_as_build: + python: + min_pin: x.x + max_pin: x.x +python: +- 3.8.* *_cpython +target_platform: +- osx-64 +zip_keys: +- - cxx_compiler_version + - fortran_compiler_version diff --git a/conda_package/ci/osx_python3.9.yaml b/conda_package/ci/osx_64_python3.9.____cpython.yaml similarity index 95% rename from conda_package/ci/osx_python3.9.yaml rename to conda_package/ci/osx_64_python3.9.____cpython.yaml index 7262ae4f0..8e1712f42 100644 --- a/conda_package/ci/osx_python3.9.yaml +++ b/conda_package/ci/osx_64_python3.9.____cpython.yaml @@ -7,17 +7,17 @@ channel_targets: cxx_compiler: - clangxx cxx_compiler_version: -- '15' +- '16' fortran_compiler: - gfortran fortran_compiler_version: - '12' hdf5: -- 1.14.2 +- 1.14.3 libnetcdf: - 4.9.2 llvm_openmp: -- '15' +- '16' macos_machine: - x86_64-apple-darwin13.4.0 netcdf_fortran: diff --git a/mesh_tools/mesh_conversion_tools_netcdf_c/mpas_cell_culler.cpp b/mesh_tools/mesh_conversion_tools_netcdf_c/mpas_cell_culler.cpp index e4168333a..3ac3859a1 100755 --- a/mesh_tools/mesh_conversion_tools_netcdf_c/mpas_cell_culler.cpp +++ b/mesh_tools/mesh_conversion_tools_netcdf_c/mpas_cell_culler.cpp @@ -1035,6 +1035,8 @@ int mapAndOutputCellFields( const string inputFilename, const string outputPath, int *tmp_arr_old, *nEdgesOnCellOld, *nEdgesOnCellNew; int *tmp_arr_new; + bool hasMeshDensity; + tmp_arr_old = new int[nCells*maxEdges]; nEdgesOnCellOld = new int[nCells]; nEdgesOnCellNew = new int[nCellsNew]; @@ -1175,20 +1177,30 @@ int mapAndOutputCellFields( const string inputFilename, const string outputPath, // Map meshDensity meshDensityOld = new double[nCells]; - meshDensityNew = new double[nCellsNew]; - ncutil::get_var(inputFilename, "meshDensity", meshDensityOld); + try { + ncutil::get_var(inputFilename, "meshDensity", meshDensityOld); + hasMeshDensity = true; + } catch (...) { + // allow errors for optional vars. not found + hasMeshDensity = false; + } - for(int iCell = 0; iCell < nCells; iCell++){ - if(cellMap.at(iCell) != -1){ - meshDensityNew[cellMap.at(iCell)] = meshDensityOld[iCell]; + if(hasMeshDensity) { + meshDensityNew = new double[nCellsNew]; + for(int iCell = 0; iCell < nCells; iCell++){ + if(cellMap.at(iCell) != -1){ + meshDensityNew[cellMap.at(iCell)] = meshDensityOld[iCell]; + } } - } - ncutil::def_var(outputFilename, "meshDensity", - NC_DOUBLE, "mesh density distribution", {"nCells"}); + ncutil::def_var(outputFilename, "meshDensity", + NC_DOUBLE, "mesh density distribution", {"nCells"}); - ncutil::put_var(outputFilename, "meshDensity", &meshDensityNew[0]); + ncutil::put_var(outputFilename, "meshDensity", &meshDensityNew[0]); + delete[] meshDensityNew; + } + delete[] meshDensityOld; return 0; }/*}}}*/ @@ -1220,6 +1232,8 @@ int mapAndOutputEdgeFields( const string inputFilename, const string outputFilen double *dcEdgeOld, *dcEdgeNew; double *angleEdgeOld, *angleEdgeNew; + bool hasWeightsOnEdge, hasAngleEdge; + // Need to map cellsOnEdge and verticesOnEdge cellsOnEdgeOld = new int[nEdges*2]; cellsOnEdgeNew = new int[nEdgesNew*2]; @@ -1320,7 +1334,13 @@ int mapAndOutputEdgeFields( const string inputFilename, const string outputFilen ncutil::get_var(inputFilename, "nEdgesOnEdge", nEdgesOnEdgeOld); ncutil::get_var(inputFilename, "edgesOnEdge", edgesOnEdgeOld); - ncutil::get_var(inputFilename, "weightsOnEdge", weightsOnEdgeOld); + try{ + ncutil::get_var(inputFilename, "weightsOnEdge", weightsOnEdgeOld); + hasWeightsOnEdge = true; + } catch (...) { + // allow errors for optional vars. not found + hasWeightsOnEdge = false; + } for(int iEdge = 0; iEdge < nEdges; iEdge++){ int edgeCount = 0; @@ -1344,24 +1364,32 @@ int mapAndOutputEdgeFields( const string inputFilename, const string outputFilen if(eoe != -1 && eoe < edgeMap.size()){ edgesOnEdgeNew[edgeMap.at(iEdge)*maxEdges2New + j] = edgeMap.at(eoe) + 1; - weightsOnEdgeNew[edgeMap.at(iEdge)*maxEdges2New + j] = - weightsOnEdgeOld[iEdge*maxEdges*2 + j]; + if(hasWeightsOnEdge) { + weightsOnEdgeNew[edgeMap.at(iEdge)*maxEdges2New + j] = + weightsOnEdgeOld[iEdge*maxEdges*2 + j]; + } edgeCount++; } else { edgesOnEdgeNew[edgeMap.at(iEdge)*maxEdges2New + j] = 0; - weightsOnEdgeNew[edgeMap.at(iEdge)*maxEdges2New + j] = 0; + if(hasWeightsOnEdge) { + weightsOnEdgeNew[edgeMap.at(iEdge)*maxEdges2New + j] = 0; + } } } } else if ( cell1 == -1 || cell2 == -1){ for(int j = 0; j < nEdgesOnEdgeOld[iEdge]; j++){ edgesOnEdgeNew[edgeMap.at(iEdge)*maxEdges2New + j] = 0; - weightsOnEdgeNew[edgeMap.at(iEdge)*maxEdges2New + j] = 0; + if(hasWeightsOnEdge) { + weightsOnEdgeNew[edgeMap.at(iEdge)*maxEdges2New + j] = 0; + } } } for(int j = edgeCount; j < maxEdges2New; j++){ edgesOnEdgeNew[edgeMap.at(iEdge)*maxEdges2New + j] = 0; - weightsOnEdgeNew[edgeMap.at(iEdge)*maxEdges2New + j] = 0; + if(hasWeightsOnEdge){ + weightsOnEdgeNew[edgeMap.at(iEdge)*maxEdges2New + j] = 0; + } } nEdgesOnEdgeNew[edgeMap.at(iEdge)] = edgeCount; } @@ -1375,10 +1403,12 @@ int mapAndOutputEdgeFields( const string inputFilename, const string outputFilen ncutil::put_var(outputFilename, "nEdgesOnEdge", &nEdgesOnEdgeNew[0]); ncutil::put_var(outputFilename, "edgesOnEdge", &edgesOnEdgeNew[0]); - ncutil::def_var(outputFilename, "weightsOnEdge", - NC_DOUBLE, "tangential flux reconstruction weights", {"nEdges", "maxEdges2"}); + if(hasWeightsOnEdge) { + ncutil::def_var(outputFilename, "weightsOnEdge", + NC_DOUBLE, "tangential flux reconstruction weights", {"nEdges", "maxEdges2"}); - ncutil::put_var(outputFilename, "weightsOnEdge", &weightsOnEdgeNew[0]); + ncutil::put_var(outputFilename, "weightsOnEdge", &weightsOnEdgeNew[0]); + } delete[] nEdgesOnEdgeOld; delete[] cellsOnEdgeOld; @@ -1397,13 +1427,22 @@ int mapAndOutputEdgeFields( const string inputFilename, const string outputFilen ncutil::get_var(inputFilename, "dvEdge", dvEdgeOld); ncutil::get_var(inputFilename, "dcEdge", dcEdgeOld); - ncutil::get_var(inputFilename, "angleEdge", angleEdgeOld); + + try{ + ncutil::get_var(inputFilename, "angleEdge", angleEdgeOld); + hasAngleEdge = true; + } catch (...) { + // allow errors for optional vars. not found + hasAngleEdge = false; + } for(int iEdge = 0; iEdge < nEdges; iEdge++){ if(edgeMap.at(iEdge) != -1){ dvEdgeNew[edgeMap.at(iEdge)] = dvEdgeOld[iEdge]; dcEdgeNew[edgeMap.at(iEdge)] = dcEdgeOld[iEdge]; - angleEdgeNew[edgeMap.at(iEdge)] = angleEdgeOld[iEdge]; + if(hasAngleEdge) { + angleEdgeNew[edgeMap.at(iEdge)] = angleEdgeOld[iEdge]; + } } } @@ -1416,7 +1455,9 @@ int mapAndOutputEdgeFields( const string inputFilename, const string outputFilen ncutil::put_var(outputFilename, "dvEdge", &dvEdgeNew[0]); ncutil::put_var(outputFilename, "dcEdge", &dcEdgeNew[0]); - ncutil::put_var(outputFilename, "angleEdge", &angleEdgeNew[0]); + if(hasAngleEdge) { + ncutil::put_var(outputFilename, "angleEdge", &angleEdgeNew[0]); + } delete[] dvEdgeOld; delete[] dvEdgeNew;