Changeset 1064
- Timestamp:
- 03/02/17 10:42:39 (8 years ago)
- Location:
- XIOS/trunk
- Files:
-
- 1 deleted
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/inputs/REMAP/iodef.xml
r1018 r1064 5 5 <calendar type="Gregorian" start_date="2012-03-01 15:00:00" time_origin="2012-02-28 15:00:00 + 1d" /> 6 6 <field_definition level="1" > 7 <field_group id="fields_src" operation="instant" >7 <field_group id="fields_src" operation="instant" default_value="100000"> 8 8 <field id="src_field_2D" domain_ref="src_domain" /> 9 <field id="src_field_2D_clone" domain_ref="src_domain_clone" />9 <field id="src_field_2D_clone" domain_ref="src_domain_clone" detect_missing_value=".TRUE." /> 10 10 <field id="src_field_3D" domain_ref="src_domain" axis_ref="src_axis" /> 11 <field id="src_field_3D_clone" grid_ref="src_grid_3D" detect_missing_value=".TRUE." default_value="100000"/>11 <field id="src_field_3D_clone" grid_ref="src_grid_3D" detect_missing_value=".TRUE." /> 12 12 <field id="src_field_3D_pression" grid_ref="src_grid_3D" /> 13 <field id="src_field_4D" grid_ref="src_grid_4D" detect_missing_value=".TRUE." default_value="100000"/>13 <field id="src_field_4D" grid_ref="src_grid_4D" detect_missing_value=".TRUE." /> 14 14 </field_group> 15 15 <field_group id="fields_dst"> 16 16 <field id="dst_field_2D" field_ref="src_field_2D" domain_ref="dst_domain"/> 17 17 <field id="dst_field_2D_regular_pole" field_ref="src_field_2D" domain_ref="dst_domain_regular_pole"/> 18 <field id="dst_field_2D_clone" field_ref="src_field_2D_clone" domain_ref="dst_domain "/>18 <field id="dst_field_2D_clone" field_ref="src_field_2D_clone" domain_ref="dst_domain_regular_pole" expr="@this" operation="average" detect_missing_value=".true."/> 19 19 <field id="dst_field_2D_extract" field_ref="src_field_3D_clone" grid_ref="dst_grid_2D_extract"/> 20 20 <field id="dst_field_3D" field_ref="src_field_3D" grid_ref="dst_grid_3D"/> … … 23 23 </field_group> 24 24 <field_group id="read_fields" operation="instant"> 25 <!-- <field id="tmp_field_0" domain_ref="src_domain_regular_read"/> 26 <field id="tmp_field_clone" field_ref="tmp_field_0"/> 25 <field id="tmp_field_0" domain_ref="src_domain_regular_read"/> 27 26 <field id="tmp_field_1" grid_ref="src_grid_curvilinear_read" /> 28 27 <field id="tmp_field_2" grid_ref="src_grid_unstructured_read" /> 28 <field id="tmp_field_clone" field_ref="tmp_field_0"/> 29 29 <field id="dst_field_regular" field_ref="tmp_field_2" grid_ref="dst_grid_regular"/> 30 30 <field id="dst_field_regular_pole_0" field_ref="tmp_field_0" domain_ref="dst_domain_regular_pole"/> 31 <field id="dst_field_regular_pole_1" field_ref="tmp_field_clone" domain_ref="dst_domain_regular_pole"/> -->31 <field id="dst_field_regular_pole_1" field_ref="tmp_field_clone" domain_ref="dst_domain_regular_pole"/> 32 32 </field_group> 33 33 </field_definition> … … 37 37 <file id="output_2D" name="output_2D" > 38 38 <field field_ref="src_field_2D" name="field_src" /> 39 <field field_ref="src_field_2D_clone" name="field_src_clone" /> 39 40 <field field_ref="src_field_2D" name="field_dst_regular_0" domain_ref="dst_domain_regular_pole" /> 40 41 <field field_ref="dst_field_2D" name="field_dst_regular_1" /> … … 49 50 <field field_ref="dst_field_3D_interp" name="field_dst_interp_domain_axis" domain_ref="dst_domain_regular_pole"/> 50 51 </file> 51 <file id="output_4D" name="output_4D" enabled=". FALSE.">52 <file id="output_4D" name="output_4D" enabled=".TRUE."> 52 53 <field field_ref="src_field_4D" name="field_4D" /> 53 54 <field field_ref="dst_field_4D_extract" name="field_4D_extract" /> … … 55 56 </file_group> 56 57 <file_group id="read_files" > 57 <!--<file id="output_src_regular" name="output_src_regular" mode="read" >58 <file id="output_src_regular" name="output_src_regular" mode="read" > 58 59 <field id="src_field_regular" name="field" grid_ref="src_grid_regular_read" operation="instant"/> 59 60 </file> … … 63 64 <file id="output_src_unstructured" name="output_src_unstructured" mode="read" > 64 65 <field id="src_field_unstructured" name="field" grid_ref="src_grid_unstructured_read" operation="instant"/> 65 </file> -->66 </file> 66 67 </file_group> 67 <file_group id="read_then_write_files" enabled=".FALSE."> 68 <!-- <file id="output_regular_pole" name="output_dst_regular" > 68 <file_group id="read_then_write_files" enabled=".TRUE."> 69 <file id="output_regular_pole" name="output_dst_regular" > 70 <field field_ref="tmp_field_0" name="field_regular_0" /> 69 71 <field field_ref="dst_field_regular" name="field_regular" /> 70 72 <field field_ref="dst_field_regular_pole_0" name="field_regular_pole_0" /> … … 76 78 <file id="output_dst_unstructured" name="output_dst_unstructured" > 77 79 <field field_ref="tmp_field_2" operation="instant"/> 78 </file> -->80 </file> 79 81 </file_group> 80 82 </file_definition> … … 94 96 <axis id="src_axis" positive="down" /> 95 97 <axis id="nq" positive="down" /> 96 <axis id="src_axis_curvilinear_read" />98 <axis id="src_axis_curvilinear_read" positive="down" /> 97 99 </axis_group> 98 100 <axis_group id="axis_dst"> … … 113 115 </domain> 114 116 <domain id="src_domain_unstructured_read" type="unstructured"> 117 <generate_rectilinear_domain/> 115 118 </domain> 116 119 </domain_group> … … 126 129 <domain id="dst_domain_regular_pole" ni_glo="90" nj_glo="45" type="rectilinear"> 127 130 <generate_rectilinear_domain id="domain_regular_pole"/> 128 <interpolate_domain write_weight="false" />131 <interpolate_domain write_weight="false" order="1" renormalize="true"/> 129 132 <!-- <zoom_domain ibegin="0" ni="45" jbegin="0" nj="45" /> --> 130 133 </domain> -
XIOS/trunk/src/config/domain_attribute_private.conf
r821 r1064 10 10 DECLARE_ATTRIBUTE_PRIVATE(double, bounds_lat_end) 11 11 12 // Array contain whole value (non distributed) of longitude and latitude read from a file12 // Array contain whole value (non distributed) of longitude and latitude of rectilinear read from a file 13 13 DECLARE_ARRAY_PRIVATE(double, 1, lonvalue_rectilinear_read_from_file) 14 14 DECLARE_ARRAY_PRIVATE(double, 1, latvalue_rectilinear_read_from_file) 15 16 // Array contain whole value (non distributed) of longitude and latitude of curvilinear read from a file 17 DECLARE_ARRAY_PRIVATE(double, 2, lonvalue_curvilinear_read_from_file) 18 DECLARE_ARRAY_PRIVATE(double, 2, latvalue_curvilinear_read_from_file) 19 DECLARE_ARRAY_PRIVATE(double, 3, bounds_lonvalue_curvilinear_read_from_file) 20 DECLARE_ARRAY_PRIVATE(double, 3, bounds_latvalue_curvilinear_read_from_file) 21 22 // Array contain whole value (non distributed) of longitude and latitude of unstructured read from a file 23 DECLARE_ARRAY_PRIVATE(double, 1, lonvalue_unstructured_read_from_file) 24 DECLARE_ARRAY_PRIVATE(double, 1, latvalue_unstructured_read_from_file) 25 DECLARE_ARRAY_PRIVATE(double, 2, bounds_lonvalue_unstructured_read_from_file) 26 DECLARE_ARRAY_PRIVATE(double, 2, bounds_latvalue_unstructured_read_from_file) 15 27 16 28 DECLARE_ATTRIBUTE_PRIVATE(int, global_zoom_ibegin) -
XIOS/trunk/src/io/nc4_data_input.cpp
r967 r1064 262 262 itMapNj = itMapNi; ++itMapNj; 263 263 264 if ((CDomain::type_attr::rectilinear == domain->type)) // || this->isRectilinear(fieldId))264 if ((CDomain::type_attr::rectilinear == domain->type)) 265 265 { 266 266 // Ok, try to read some f.. attributes such as longitude and latitude … … 279 279 std::vector<StdSize> nBeginLon(1, 0), nSizeLon(1, itMapNi->second); 280 280 readFieldVariableValue(domain->lonvalue_rectilinear_read_from_file, itMapNi->first, nBeginLon, nSizeLon, true); 281 } 282 domain->fillInRectilinearLonLat(); 283 } 284 else if ((CDomain::type_attr::curvilinear == domain->type))// || (this->isCurvilinear(fieldId))) 281 } 282 } 283 else if ((CDomain::type_attr::curvilinear == domain->type)) 285 284 { 286 285 int ni = domain->ni; 287 286 int nj = domain->nj; 288 287 std::vector<StdSize> nBeginLatLon(2), nSizeLatLon(2); 289 nBeginLatLon[0] = domain->jbegin.getValue(); nBeginLatLon[1] = domain->ibegin.getValue();290 nSizeLatLon[0] = nj; nSizeLatLon[1] = ni;288 nBeginLatLon[0] = 0; nBeginLatLon[1] = 0; 289 nSizeLatLon[0] = domain->nj_glo.getValue(); nSizeLatLon[1] = domain->ni_glo.getValue(); 291 290 292 291 StdString latName = this->getLatCoordName(fieldId); 293 if (SuperClassWriter::hasVariable(latName)) //(0 != latName.compare(""))294 { 295 domain->latvalue_ 2d.resize(ni,nj);296 readFieldVariableValue(domain->latvalue_ 2d, latName, nBeginLatLon, nSizeLatLon);292 if (SuperClassWriter::hasVariable(latName)) 293 { 294 domain->latvalue_curvilinear_read_from_file.resize(domain->ni_glo,domain->nj_glo); 295 readFieldVariableValue(domain->latvalue_curvilinear_read_from_file, latName, nBeginLatLon, nSizeLatLon); 297 296 } 298 297 StdString lonName = this->getLonCoordName(fieldId); 299 if (SuperClassWriter::hasVariable(lonName)) //(0 != lonName.compare(""))300 { 301 domain->lonvalue_ 2d.resize(ni,nj);302 readFieldVariableValue(domain->lonvalue_ 2d, lonName, nBeginLatLon, nSizeLatLon);298 if (SuperClassWriter::hasVariable(lonName)) 299 { 300 domain->lonvalue_curvilinear_read_from_file.resize(domain->ni_glo,domain->nj_glo); 301 readFieldVariableValue(domain->lonvalue_curvilinear_read_from_file, lonName, nBeginLatLon, nSizeLatLon); 303 302 } 304 303 … … 307 306 308 307 int nbVertex = this->getNbVertex(fieldId); 309 if (SuperClassWriter::hasVariable(boundsLatName) || SuperClassWriter::hasVariable(boundsLonName)) //if ((0 != boundsLatName.compare("")) || (0 != boundsLonName.compare(""))) 308 if (!domain->nvertex.isEmpty() && (domain->nvertex != nbVertex)) 309 { 310 ERROR("void CNc4DataInput::readDomainAttributeValueFromFile(...)", 311 << "The domain " << domain->getDomainOutputName() 312 << " has nvertex read from file " << this->filename << " and nvertex provided from model" 313 << " are not coherent. They should be the same." << std::endl 314 << " nvertex read from file: "<< nbVertex 315 << " nvertex from model: "<< domain->nvertex << std::endl); 316 } 317 318 if (SuperClassWriter::hasVariable(boundsLatName) || SuperClassWriter::hasVariable(boundsLonName)) 310 319 domain->nvertex.setValue(nbVertex); 320 311 321 std::vector<StdSize> nBeginBndsLatLon(3), nSizeBndsLatLon(3); 312 nBeginBndsLatLon[0] = domain->jbegin.getValue(); nSizeBndsLatLon[0] = nj;313 nBeginBndsLatLon[1] = domain->ibegin.getValue(); nSizeBndsLatLon[1] = ni;322 nBeginBndsLatLon[0] = 0; nSizeBndsLatLon[0] = domain->nj_glo.getValue(); 323 nBeginBndsLatLon[1] = 0; nSizeBndsLatLon[1] = domain->nj_glo.getValue(); 314 324 nBeginBndsLatLon[2] = 0; nSizeBndsLatLon[2] = nbVertex; 315 325 316 if (SuperClassWriter::hasVariable(boundsLatName)) //(0 != boundsLatName.compare(""))317 { 318 domain->bounds_lat _2d.resize(nbVertex,ni,nj);319 readFieldVariableValue(domain->bounds_lat _2d, boundsLatName, nBeginBndsLatLon, nSizeBndsLatLon);320 321 } 322 if (SuperClassWriter::hasVariable(boundsLonName)) //(0 != boundsLonName.compare(""))323 { 324 domain->bounds_lon _2d.resize(nbVertex,ni,nj);325 readFieldVariableValue(domain->bounds_lon _2d, boundsLonName, nBeginBndsLatLon, nSizeBndsLatLon);326 } 326 if (SuperClassWriter::hasVariable(boundsLatName)) 327 { 328 domain->bounds_latvalue_curvilinear_read_from_file.resize(nbVertex,domain->ni_glo,domain->nj_glo); 329 readFieldVariableValue(domain->bounds_latvalue_curvilinear_read_from_file, boundsLatName, nBeginBndsLatLon, nSizeBndsLatLon); 330 331 } 332 if (SuperClassWriter::hasVariable(boundsLonName)) 333 { 334 domain->bounds_lonvalue_curvilinear_read_from_file.resize(nbVertex,domain->ni_glo,domain->nj_glo); 335 readFieldVariableValue(domain->bounds_lonvalue_curvilinear_read_from_file, boundsLonName, nBeginBndsLatLon, nSizeBndsLatLon); 336 } 327 337 } 328 338 else if ((CDomain::type_attr::unstructured == domain->type))// || (this->isUnstructured(fieldId))) 329 339 { 330 /*331 if (domain->i_index.isEmpty())332 ERROR("CNc4DataInput::readDomainAttributeValueFromFile(...)",333 << "Field '" << fieldId << std::endl334 << "Trying to read attributes from unstructured grid."335 << "i_index of domain" << domain->getId() << " is mandatory");336 337 int ni = domain->i_index.numElements();338 */339 340 int ni = domain->ni.isEmpty() ? 0 : domain->ni;341 int ibegin = domain->ibegin.isEmpty() ? 0 : domain->ibegin;342 343 if (domain->i_index.isEmpty() && (!domain->ni.isEmpty()) )344 {345 domain->i_index.resize(ni) ;346 for(int idx = 0; idx < ni; ++idx) domain->i_index(idx)=ibegin+idx ;347 }348 349 340 std::vector<StdSize> nBeginLatLon(1,0), nSizeLatLon(1,0); 350 341 nSizeLatLon[0] = domain->ni_glo.getValue(); … … 352 343 353 344 StdString latName = this->getLatCoordName(fieldId); 354 if (SuperClassWriter::hasVariable(latName)) //(0 != latName.compare("")) 355 { 356 readFieldVariableValue(globalLonLat, latName, nBeginLatLon, nSizeLatLon); 357 domain->latvalue_1d.resize(ni); 358 for (int idx = 0; idx < ni; ++idx) 359 domain->latvalue_1d(idx) = globalLonLat(domain->i_index(idx)); 345 if (SuperClassWriter::hasVariable(latName)) 346 { 347 domain->latvalue_unstructured_read_from_file.resize(domain->ni_glo); 348 readFieldVariableValue(domain->latvalue_unstructured_read_from_file, latName, nBeginLatLon, nSizeLatLon); 360 349 } 361 350 … … 363 352 if (SuperClassWriter::hasVariable(lonName)) //(0 != lonName.compare("")) 364 353 { 365 readFieldVariableValue(globalLonLat, lonName, nBeginLatLon, nSizeLatLon); 366 domain->lonvalue_1d.resize(ni); 367 for (int idx = 0; idx < ni; ++idx) 368 domain->lonvalue_1d(idx) = globalLonLat(domain->i_index(idx)); 354 // readFieldVariableValue(globalLonLat, lonName, nBeginLatLon, nSizeLatLon); 355 domain->lonvalue_unstructured_read_from_file.resize(domain->ni_glo); 356 readFieldVariableValue(domain->lonvalue_unstructured_read_from_file, lonName, nBeginLatLon, nSizeLatLon); 369 357 } 370 358 … … 373 361 374 362 int nbVertex = this->getNbVertex(fieldId); 375 if (SuperClassWriter::hasVariable(boundsLatName) || SuperClassWriter::hasVariable(boundsLonName)) // (0 != boundsLatName.compare("")) || (0 != boundsLonName.compare(""))) 363 if (!domain->nvertex.isEmpty() && (domain->nvertex != nbVertex)) 364 { 365 ERROR("void CNc4DataInput::readDomainAttributeValueFromFile(...)", 366 << "The domain " << domain->getDomainOutputName() 367 << " has nvertex read from file " << this->filename << " and nvertex provided from model" 368 << " are not coherent. They should be the same." << std::endl 369 << " nvertex read from file: "<< nbVertex 370 << " nvertex from model: "<< domain->nvertex << std::endl); 371 } 372 373 if (SuperClassWriter::hasVariable(boundsLatName) || SuperClassWriter::hasVariable(boundsLonName)) 376 374 domain->nvertex.setValue(nbVertex); 377 375 … … 380 378 nBeginBndsLatLon[1] = 0; nSizeBndsLatLon[1] = nbVertex; 381 379 382 if (SuperClassWriter::hasVariable(boundsLatName)) //(0 != boundsLatName.compare("")) 383 { 384 CArray<double,2> globalBndsLonLat(nSizeBndsLatLon[1], nSizeBndsLatLon[0]); 385 readFieldVariableValue(globalBndsLonLat, boundsLatName, nBeginBndsLatLon, nSizeBndsLatLon); 386 domain->bounds_lat_1d.resize(nbVertex,ni); 387 for (int idx = 0; idx < ni; ++idx) 388 for (int jdx = 0; jdx < nbVertex; ++jdx) 389 domain->bounds_lat_1d(jdx,idx) = globalBndsLonLat(jdx, domain->i_index(idx)); 390 } 391 392 if (SuperClassWriter::hasVariable(boundsLonName)) //(0 != boundsLonName.compare("")) 393 { 394 CArray<double,2> globalBndsLonLat(nSizeBndsLatLon[1], nSizeBndsLatLon[0]); 395 readFieldVariableValue(globalBndsLonLat, boundsLonName, nBeginBndsLatLon, nSizeBndsLatLon); 396 domain->bounds_lon_1d.resize(nbVertex,ni); 397 for (int idx = 0; idx < ni; ++idx) 398 for (int jdx = 0; jdx < nbVertex; ++jdx) 399 domain->bounds_lon_1d(jdx,idx) = globalBndsLonLat(jdx, domain->i_index(idx)); 400 } 401 } 380 if (SuperClassWriter::hasVariable(boundsLatName)) 381 { 382 domain->bounds_latvalue_unstructured_read_from_file.resize(nSizeBndsLatLon[1], nSizeBndsLatLon[0]); 383 readFieldVariableValue(domain->bounds_latvalue_unstructured_read_from_file, boundsLatName, nBeginBndsLatLon, nSizeBndsLatLon); 384 } 385 386 if (SuperClassWriter::hasVariable(boundsLonName)) 387 { 388 domain->bounds_lonvalue_unstructured_read_from_file.resize(nSizeBndsLatLon[1], nSizeBndsLatLon[0]); 389 readFieldVariableValue(domain->bounds_lonvalue_unstructured_read_from_file, boundsLonName, nBeginBndsLatLon, nSizeBndsLatLon); 390 } 391 } 392 domain->fillInLonLat(); 402 393 } 403 394 … … 421 412 if (this->isRectilinear(fieldId) || this->isCurvilinear(fieldId)) 422 413 { 414 if (!domain->nj_glo.isEmpty() && (domain->nj_glo != itMapNj->second)) 415 { 416 ERROR("void CNc4DataInput::readDomainAttributesFromFile(...)", 417 << "The domain " << domain->getDomainOutputName() 418 << " has nj_glo read from file " << this->filename << " and nj_glo provided from model" 419 << " are not coherent. They should be the same." << std::endl 420 << " nj_glo read from file: "<< itMapNj->second 421 << " nj_glo from model: "<< domain->nj_glo << std::endl); 422 } 423 423 domain->nj_glo.setValue(itMapNj->second); 424 425 if (!domain->ni_glo.isEmpty() && (domain->ni_glo != itMapNi->second)) 426 { 427 ERROR("void CNc4DataInput::readDomainAttributesFromFile(...)", 428 << "The domain " << domain->getDomainOutputName() 429 << " has ni_glo read from file " << this->filename << " and ni_glo provided from model" 430 << " are not coherent. They should be the same." << std::endl 431 << " ni_glo read from file: "<< itMapNi->second 432 << " ni_glo from model: "<< domain->ni_glo << std::endl); 433 } 424 434 domain->ni_glo.setValue(itMapNi->second); 425 435 } … … 427 437 { 428 438 domain->nj_glo.setValue(1); 439 440 if (!domain->ni_glo.isEmpty() && (domain->ni_glo != itMapNi->second)) 441 { 442 ERROR("void CNc4DataInput::readDomainAttributesFromFile(...)", 443 << "The domain " << domain->getDomainOutputName() 444 << " has ni_glo read from file " << this->filename << " and ni_glo provided from model" 445 << " are not coherent. They should be the same." << std::endl 446 << " ni_glo read from file: "<< itMapNi->second 447 << " ni_glo from model: "<< domain->ni_glo << std::endl); 448 } 429 449 domain->ni_glo.setValue(itMapNi->second); 430 450 } … … 444 464 iteMap = dimSizeMap.end(); 445 465 for (int i = 0; i < elementPosition; ++i, ++itMapN) {} 466 467 if (!axis->n_glo.isEmpty() && (axis->n_glo != itMapN->second)) 468 { 469 ERROR("void CNc4DataInput::readAxisAttributesFromFile(...)", 470 << "The axis " << axis->getAxisOutputName() 471 << " has n_glo read from file " << this->filename << " and n_glo provided from model" 472 << " are not coherent. They should be the same." << std::endl 473 << " n_glo read from file: "<< itMapN->second 474 << " n_glo from model: "<< axis->n_glo << std::endl); 475 } 446 476 axis->n_glo.setValue(itMapN->second); 447 477 } … … 483 513 int elementPosition, const StdString& fieldId) 484 514 { 485 // std::list<std::pair<StdString, StdSize> >::const_iterator itMapN = dimSizeMap.begin(), 486 // iteMap = dimSizeMap.end(); 487 // for (int i = 0; i < elementPosition; ++i, ++itMapN) {} 488 // axis->n_glo.setValue(itMapN->second); 515 /*Nothing to do */ 489 516 } 490 517 … … 499 526 int elementPosition, const StdString& fieldId) 500 527 { 501 // std::list<std::pair<StdString, StdSize> >::const_iterator itMapN = dimSizeMap.begin(), 502 // iteMap = dimSizeMap.end(); 503 // for (int i = 0; i < elementPosition; ++i, ++itMapN) {} 504 // 505 // { // Read axis value 506 // std::vector<StdSize> nBegin(1, 0), nSize(1, itMapN->second); 507 // CArray<double,1> readAxisValue(itMapN->second); 508 // readFieldVariableValue(readAxisValue, itMapN->first, nBegin, nSize, true); 509 // int begin = 0, n = itMapN->second; 510 // if (!axis->begin.isEmpty()) begin = axis->begin.getValue(); 511 // if (!axis->n.isEmpty()) n = axis->n.getValue(); 512 // axis->value.resize(n); 513 // for (int i = 0; i < n; ++i) axis->value(i) = readAxisValue(begin + i); 514 // } 528 /*Nothing to do */ 515 529 } 516 530 -
XIOS/trunk/src/node/domain.cpp
r1062 r1064 225 225 226 226 //---------------------------------------------------------------- 227 228 /*! 229 Verify if all distribution information of a domain are available 230 This checking verifies the definition of distribution attributes (ni, nj, ibegin, jbegin) 231 */ 232 bool CDomain::distributionAttributesHaveValue() const 233 { 234 bool hasValues = true; 235 236 if (ni.isEmpty() && ibegin.isEmpty() && i_index.isEmpty()) 237 { 238 hasValues = false; 239 return hasValues; 240 } 241 242 return hasValues; 243 } 227 244 228 245 /*! … … 333 350 ni.setValue(ni_glo - ibeginVec[iIdx]); 334 351 } 335 } 336 337 // Now fill other attributes 338 if (type_attr::rectilinear == type) fillInRectilinearLonLat(); 352 } 339 353 } 340 354 else // unstructured domain … … 382 396 nj.setValue(1); 383 397 } 398 399 i_index.resize(ni); 400 for(int idx = 0; idx < ni; ++idx) i_index(idx)=ibegin+idx; 384 401 } 385 402 else … … 393 410 394 411 checkDomain(); 412 } 413 414 /*! 415 Fill in longitude and latitude whose values are read from file 416 */ 417 void CDomain::fillInLonLat() 418 { 419 switch (type) 420 { 421 case type_attr::rectilinear: 422 fillInRectilinearLonLat(); 423 break; 424 case type_attr::curvilinear: 425 fillInCurvilinearLonLat(); 426 break; 427 case type_attr::unstructured: 428 fillInUnstructuredLonLat(); 429 break; 430 431 default: 432 break; 433 } 434 395 435 } 396 436 … … 470 510 } 471 511 472 473 512 /* 513 Fill in longitude and latitude of curvilinear domain read from a file 514 If there are already longitude and latitude defined by model. We just igonore reading value. 515 */ 516 void CDomain::fillInCurvilinearLonLat() 517 { 518 if (!lonvalue_curvilinear_read_from_file.isEmpty() && lonvalue_2d.isEmpty()) 519 { 520 lonvalue_2d.resize(ni,nj); 521 for (int jdx = 0; jdx < nj; ++jdx) 522 for (int idx = 0; idx < ni; ++idx) 523 lonvalue_2d(idx,jdx) = lonvalue_curvilinear_read_from_file(idx+ibegin, jdx+jbegin); 524 525 lonvalue_curvilinear_read_from_file.free(); 526 } 527 528 if (!latvalue_curvilinear_read_from_file.isEmpty() && latvalue_2d.isEmpty()) 529 { 530 latvalue_2d.resize(ni,nj); 531 for (int jdx = 0; jdx < nj; ++jdx) 532 for (int idx = 0; idx < ni; ++idx) 533 latvalue_2d(idx,jdx) = latvalue_curvilinear_read_from_file(idx+ibegin, jdx+jbegin); 534 535 latvalue_curvilinear_read_from_file.free(); 536 } 537 538 if (!bounds_lonvalue_curvilinear_read_from_file.isEmpty() && bounds_lon_2d.isEmpty()) 539 { 540 bounds_lon_2d.resize(nvertex,ni,nj); 541 for (int jdx = 0; jdx < nj; ++jdx) 542 for (int idx = 0; idx < ni; ++idx) 543 for (int ndx = 0; ndx < nvertex; ++ndx) 544 bounds_lon_2d(ndx,idx,jdx) = bounds_lonvalue_curvilinear_read_from_file(ndx,idx+ibegin, jdx+jbegin); 545 546 bounds_lonvalue_curvilinear_read_from_file.free(); 547 } 548 549 if (!bounds_latvalue_curvilinear_read_from_file.isEmpty() && bounds_lat_2d.isEmpty()) 550 { 551 bounds_lat_2d.resize(nvertex,ni,nj); 552 for (int jdx = 0; jdx < nj; ++jdx) 553 for (int idx = 0; idx < ni; ++idx) 554 for (int ndx = 0; ndx < nvertex; ++ndx) 555 bounds_lat_2d(ndx,idx,jdx) = bounds_latvalue_curvilinear_read_from_file(ndx,idx+ibegin, jdx+jbegin); 556 557 bounds_latvalue_curvilinear_read_from_file.free(); 558 } 559 560 } 561 562 /* 563 Fill in longitude and latitude of unstructured domain read from a file 564 If there are already longitude and latitude defined by model. We just igonore reading value. 565 */ 566 void CDomain::fillInUnstructuredLonLat() 567 { 568 if (i_index.isEmpty()) 569 { 570 i_index.resize(ni); 571 for(int idx = 0; idx < ni; ++idx) i_index(idx)=ibegin+idx; 572 } 573 574 if (!lonvalue_unstructured_read_from_file.isEmpty() && lonvalue_1d.isEmpty()) 575 { 576 lonvalue_1d.resize(ni); 577 for (int idx = 0; idx < ni; ++idx) 578 lonvalue_1d(idx) = lonvalue_unstructured_read_from_file(i_index(idx)); 579 580 // We dont need these values anymore, so just delete them 581 lonvalue_unstructured_read_from_file.free(); 582 } 583 584 if (!latvalue_unstructured_read_from_file.isEmpty() && latvalue_1d.isEmpty()) 585 { 586 latvalue_1d.resize(ni); 587 for (int idx = 0; idx < ni; ++idx) 588 latvalue_1d(idx) = latvalue_unstructured_read_from_file(i_index(idx)); 589 590 // We dont need these values anymore, so just delete them 591 latvalue_unstructured_read_from_file.free(); 592 } 593 594 if (!bounds_lonvalue_unstructured_read_from_file.isEmpty() && bounds_lon_1d.isEmpty()) 595 { 596 int nbVertex = nvertex; 597 bounds_lon_1d.resize(nbVertex,ni); 598 for (int idx = 0; idx < ni; ++idx) 599 for (int jdx = 0; jdx < nbVertex; ++jdx) 600 bounds_lon_1d(jdx,idx) = bounds_lonvalue_unstructured_read_from_file(jdx, i_index(idx)); 601 602 // We dont need these values anymore, so just delete them 603 lonvalue_unstructured_read_from_file.free(); 604 } 605 606 if (!bounds_latvalue_unstructured_read_from_file.isEmpty() && bounds_lat_1d.isEmpty()) 607 { 608 int nbVertex = nvertex; 609 bounds_lat_1d.resize(nbVertex,ni); 610 for (int idx = 0; idx < ni; ++idx) 611 for (int jdx = 0; jdx < nbVertex; ++jdx) 612 bounds_lat_1d(jdx,idx) = bounds_latvalue_unstructured_read_from_file(jdx, i_index(idx)); 613 614 // We dont need these values anymore, so just delete them 615 lonvalue_unstructured_read_from_file.free(); 616 } 617 } 618 619 /* 620 Get global longitude and latitude of rectilinear domain. 621 */ 474 622 void CDomain::AllgatherRectilinearLonLat(CArray<double,1>& lon, CArray<double,1>& lat, CArray<double,1>& lon_g, CArray<double,1>& lat_g) 475 623 { -
XIOS/trunk/src/node/domain.hpp
r953 r1064 103 103 bool isDistributed(void) const; 104 104 bool isCompressible(void) const; 105 bool distributionAttributesHaveValue() const; 105 106 106 107 int ni_srv,ibegin_srv,iend_srv ; … … 136 137 void fillInRectilinearBoundLonLat(CArray<double,1>& lon, CArray<double,1>& lat, 137 138 CArray<double,2>& boundsLon, CArray<double,2>& boundsLat); 138 void fillInRectilinearLonLat(); 139 140 void fillInLonLat(); 139 141 140 142 static bool dispatchEvent(CEventServer& event); … … 189 191 void sendLonLat(); 190 192 193 void fillInRectilinearLonLat(); 194 void fillInCurvilinearLonLat(); 195 void fillInUnstructuredLonLat(); 191 196 private: 192 197 bool isChecked; -
XIOS/trunk/src/test/test_remap.f90
r1018 r1064 16 16 TYPE(xios_context) :: ctx_hdl 17 17 18 DOUBLE PRECISION,ALLOCATABLE :: src_lon(:), dst_lon(:) 19 DOUBLE PRECISION,ALLOCATABLE :: src_lat(:), dst_lat(:) 18 DOUBLE PRECISION,ALLOCATABLE :: src_lon(:), dst_lon(:), src_lon_tmp(:) 19 DOUBLE PRECISION,ALLOCATABLE :: src_lat(:), dst_lat(:), src_lat_tmp(:) 20 20 DOUBLE PRECISION,ALLOCATABLE :: src_boundslon(:,:), dst_boundslon(:,:) 21 21 DOUBLE PRECISION,ALLOCATABLE :: src_boundslat(:,:), dst_boundslat(:,:) 22 DOUBLE PRECISION,ALLOCATABLE :: src_field_2D(:) 22 DOUBLE PRECISION,ALLOCATABLE :: src_field_2D(:), src_field_2D_clone(:) 23 23 DOUBLE PRECISION,ALLOCATABLE :: tmp_field_0(:), tmp_field_1(:), tmp_field_2(:) 24 24 DOUBLE PRECISION,ALLOCATABLE :: src_field_3D(:,:), src_field_4D(:,:,:), lval(:), lval1(:), lval2(:), src_field_pression(:,:) … … 36 36 INTEGER :: varid 37 37 INTEGER :: ts 38 INTEGER :: i 38 INTEGER :: i,j 39 39 INTEGER,PARAMETER :: llm=5, interpolatedLlm = 4, llm2 = 6 40 DOUBLE PRECISION, PARAMETER :: missing_value = 100000 40 41 41 42 CALL MPI_INIT(ierr) … … 64 65 ENDIF 65 66 66 ALLOCATE(src_lon(src_ni) )67 ALLOCATE(src_lat(src_ni) )67 ALLOCATE(src_lon(src_ni), src_lon_tmp(src_ni)) 68 ALLOCATE(src_lat(src_ni), src_lat_tmp(src_ni)) 68 69 ALLOCATE(src_boundslon(src_nvertex,src_ni)) 69 70 ALLOCATE(src_boundslat(src_nvertex,src_ni)) 70 ALLOCATE(src_field_2D(src_ni) )71 ALLOCATE(src_field_2D(src_ni), src_field_2D_clone(src_ni)) 71 72 ALLOCATE(src_field_3D(src_ni,llm)) 72 73 ALLOCATE(src_field_4D(src_ni,llm,llm2)) … … 89 90 DO i=1,src_ni 90 91 src_field_3D(i,:) = src_field_2D(i) 91 IF ( MOD(i,10)==0) THEN92 IF ((23.5 < src_lat(i)) .AND. (src_lat(i) < 65.5) .AND. (0 < src_lon(i)) .AND. (src_lon(i) < 30)) THEN 92 93 src_mask_2D(i)=.FALSE. 93 src_field_2D(i) = 10000094 src_field_2D(i) = missing_value 94 95 ELSE 95 96 src_mask_2D(i)=.TRUE. 96 97 ENDIF 97 ENDDO 98 src_lon_tmp(i) = src_lon(i) + 1000 99 src_lat_tmp(i) = src_lat(i) + 10000 100 ENDDO 101 src_field_2D_clone = src_field_2D 98 102 99 103 DO i=1,llm … … 101 105 src_field_pression(:,i) = i * 100 102 106 IF (MOD(i,3)==0) THEN 103 ! src_field_pression(:,i) = 100000104 src_field_3D(:,i) = 100000107 ! src_field_pression(:,i) = missing_value 108 src_field_3D(:,i) = missing_value 105 109 ELSE 106 110 ! src_field_pression(:,i) = i * 100 … … 170 174 bounds_lon_1D=dst_boundslon, bounds_lat_1D=dst_boundslat, nvertex=dst_nvertex) 171 175 176 CALL xios_set_domain_attr("src_domain_unstructured_read", ni_glo=src_ni_glo, ibegin=src_ibegin, ni=src_ni, type="unstructured") 177 CALL xios_set_domain_attr("src_domain_unstructured_read", lonvalue_1D=src_lon_tmp, latvalue_1D=src_lat_tmp, & 178 bounds_lon_1D=src_boundslon, bounds_lat_1D=src_boundslat, nvertex=src_nvertex) 179 180 172 181 dtime%second = 3600 173 182 CALL xios_set_timestep(dtime) 174 183 175 184 CALL xios_close_context_definition() 176 !CALL xios_get_domain_attr("src_domain_regular_read", ni=src_tmp_ni, nj=src_tmp_nj)177 !ALLOCATE(tmp_field_0(src_tmp_ni*src_tmp_nj))178 179 !CALL xios_get_axis_attr("src_axis_curvilinear_read", n=src_tmp_n)180 !CALL xios_get_domain_attr("src_domain_curvilinear_read", ni=src_tmp_ni, nj=src_tmp_nj)181 !ALLOCATE(tmp_field_1(src_tmp_ni*src_tmp_nj*src_tmp_n))182 183 !CALL xios_get_domain_attr("src_domain_unstructured_read", ni=src_tmp_ni, nj=src_tmp_nj)184 !ALLOCATE(tmp_field_2(src_tmp_ni*src_tmp_nj))185 186 DO ts=1, 5187 !CALL xios_recv_field("src_field_regular", tmp_field_0)188 !CALL xios_recv_field("src_field_curvilinear", tmp_field_1)189 !CALL xios_recv_field("src_field_unstructured", tmp_field_2)185 CALL xios_get_domain_attr("src_domain_regular_read", ni=src_tmp_ni, nj=src_tmp_nj) 186 ALLOCATE(tmp_field_0(src_tmp_ni*src_tmp_nj)) 187 188 CALL xios_get_axis_attr("src_axis_curvilinear_read", n=src_tmp_n) 189 CALL xios_get_domain_attr("src_domain_curvilinear_read", ni=src_tmp_ni, nj=src_tmp_nj) 190 ALLOCATE(tmp_field_1(src_tmp_ni*src_tmp_nj*src_tmp_n)) 191 192 CALL xios_get_domain_attr("src_domain_unstructured_read", ni=src_tmp_ni, nj=src_tmp_nj) 193 ALLOCATE(tmp_field_2(src_tmp_ni*src_tmp_nj)) 194 195 DO ts=1,1 196 CALL xios_recv_field("src_field_regular", tmp_field_0) 197 CALL xios_recv_field("src_field_curvilinear", tmp_field_1) 198 CALL xios_recv_field("src_field_unstructured", tmp_field_2) 190 199 CALL xios_update_calendar(ts) 191 200 CALL xios_send_field("src_field_2D",src_field_2D) 192 CALL xios_send_field("src_field_2D_clone",src_field_2D) 201 202 DO i=1,src_ni 203 src_field_2D_clone(i) = src_field_2D(i) 204 IF ((23.5 * ts < src_lat(i)) .AND. (src_lat(i) < 65.5 *ts) .AND. (0 < src_lon(i)) .AND. (src_lon(i) < 30*ts)) THEN 205 src_field_2D_clone(i) = missing_value 206 ENDIF 207 ENDDO 208 209 CALL xios_send_field("src_field_2D_clone",src_field_2D_clone) 193 210 CALL xios_send_field("src_field_3D",src_field_3D) 194 211 CALL xios_send_field("src_field_3D_clone",src_field_3D) 195 212 CALL xios_send_field("src_field_4D",src_field_4D) 196 213 CALL xios_send_field("src_field_3D_pression",src_field_pression) 197 !CALL xios_send_field("tmp_field_0",tmp_field_0)198 !CALL xios_send_field("tmp_field_1",tmp_field_1)199 !CALL xios_send_field("tmp_field_2",tmp_field_2)214 CALL xios_send_field("tmp_field_0",tmp_field_0) 215 CALL xios_send_field("tmp_field_1",tmp_field_1) 216 CALL xios_send_field("tmp_field_2",tmp_field_2) 200 217 CALL wait_us(5000) ; 201 218 ENDDO … … 205 222 DEALLOCATE(src_lon, src_lat, src_boundslon,src_boundslat, src_field_2D) 206 223 DEALLOCATE(dst_lon, dst_lat, dst_boundslon,dst_boundslat) 207 !DEALLOCATE(tmp_field_0, tmp_field_1, tmp_field_2)224 DEALLOCATE(tmp_field_0, tmp_field_1, tmp_field_2) 208 225 209 226 CALL MPI_COMM_FREE(comm, ierr) -
XIOS/trunk/src/transformation/domain_algorithm_generate_rectilinear.cpp
r933 r1064 127 127 void CDomainAlgorithmGenerateRectilinear::fillInAttributesDomainDestination() 128 128 { 129 domainDest_->redistribute(nbDomainDistributedPart_); 129 if (!domainDest_->distributionAttributesHaveValue()) 130 domainDest_->redistribute(nbDomainDistributedPart_); 131 domainDest_->fillInLonLat(); 130 132 } 131 133
Note: See TracChangeset
for help on using the changeset viewer.