Changeset 2562 in lmdz_wrf for trunk


Ignore:
Timestamp:
May 28, 2019, 7:31:54 PM (6 years ago)
Author:
lfita
Message:

Fixing various issues related to slices with single values

Location:
trunk/tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/module_scientific.f90

    r2561 r2562  
    73607360
    73617361    ! Local
    7362     INTEGER                                              :: ixA, iyA, ixB, iyB, iv, iv1, iv2
     7362    INTEGER                                              :: ixA, iyA, ixB, iyB, iv, iv1, iv2, iiv
    73637363    INTEGER                                              :: NA, NB
    73647364    INTEGER, DIMENSION(dxyA)                             :: ptsA, ptsB
    73657365    INTEGER, DIMENSION(dxyA, 2)                          :: pts
     7366    LOGICAL                                              :: found
    73667367
    73677368
     
    73967397                IF ( (pointsA(ixA,iyA,iv1,1) == pointsB(ixB,iyB,iv2,1)) .AND.                         &
    73977398                  (pointsA(ixA,iyA,iv1,2) == pointsB(ixB,iyB,iv2,2)) ) THEN
     7399                  ! need to avoid double count (in ix[X] == 1)
     7400                  found = .FALSE.
     7401                  DO iiv = 1, iv
     7402                    IF ( (pointsA(ixA,iyA,iv1,1) == points(ixA,iyB,ixB,iyB,iiv,1)) .AND.              &
     7403                      (pointsA(ixA,iyA,iv1,2) == points(ixA,iyB,ixB,iyB,iiv,2)) ) THEN
     7404                      found = .TRUE.
     7405                    END IF
     7406                  END DO
     7407                  IF (found) CYCLE
    73987408                  iv = iv + 1
    73997409                  points(ixA,iyA,ixB,iyB,iv,1) = pointsA(ixA,iyA,iv1,1)
  • trunk/tools/nc_var_tools.py

    r2561 r2562  
    2921229212                        reflat1D = varslcv[3]
    2921329213                        refblat1D = varslcv[4]
    29214                         dref.append(varn)
     29214                        #dref.append(varn)
     29215                        Nv = gen.ntimesHval_inlist(list(onewnc.dimensions), dimvars[ydim])
     29216                        varnS = dimvars[ydim] + str(Nv)
     29217                        dref.append(varnS)
     29218#                        dref.append(dimvars[ydim])
    2921529219                    else:
    2921629220                        print infmsg
     
    2924529249                        reflon1D = varslcv[3]
    2924629250                        refblon1D = varslcv[4]
    29247                         dref.append(varn)
     29251#                        dref.append(varn)
     29252                        Nv = gen.ntimesHval_inlist(list(onewnc.dimensions), dimvars[xdim])
     29253                        varnS = dimvars[xdim] + str(Nv)
     29254                        dref.append(varnS)
    2924829255                    else:
    2924929256                        print infmsg
     
    2963329640                newdim = onewnc.createDimension('coord',2)
    2963429641
    29635             print '    Lluis dims ', dn+'Ngrid', 'Srgrid', Srgrid
    29636 
    2963729642            newvar = onewnc.createVariable(dn+'Ngrid','i', tuple(Srgrid))
    2963829643            if Ngridsin.shape[1] == 1:
     
    2976429769    dxyB = osliceinB.shape[1]
    2976529770
    29766     print 'Lluis dims osliceNB', osliceNB.dimensions, 'osliceNA', osliceNA.dimensions
    29767 
    29768 
    2976929771    Srgrid = list(osliceNB.dimensions) + list(osliceNA.dimensions)
    2977029772    Sigrid = ['coord', dn+'gridin'] + Srgrid
     
    2978629788    #sliceinBt[...,1] = sliceinBt0[...,0]+1
    2978729789
    29788     iiB = 3
    29789     jjB = 0
    29790     iiA = 0
    29791     jjA = 3
    2979229790    NpointsABt, pointsABt, inpA, inpB = fsci.module_scientific.coincident_gridsin2d( \
    2979329791      npointsa=sliceNAt, pointsa=sliceinAt, npointsb=sliceNBt, pointsb=sliceinBt,    \
     
    2979829796    inpointsB = inpB.transpose()
    2979929797
    29800     print 'Lluis here 00'
    2980129798
    2980229799    # Remembering that it is python (C-like...)
     
    2981529812    if not gen.searchInlist(onewnc.dimensions, dn+'gridin'):
    2981629813        newdim = onewnc.createDimension(dn+'gridin', maxNpointsAB)
    29817 
    29818     print 'Lluis file creation'
    29819 
    29820     print 'Lluis shapes: newvar', newvar.shape, 'NpointsAB', NpointsAB.shape, 'Srgrid', Srgrid
    2982129814
    2982229815    newvar = onewnc.createVariable(dn+'Ngrid','i', tuple(Srgrid))
     
    2982629819    newvar.setncattr('coordinates',' '.join(Srgrid[::-1]))
    2982729820   
    29828     print 'Lluis file creation 1'
    29829 
    2983029821    innewvar = onewnc.createVariable(dn+'gridin', 'i', tuple(Sigrid),                \
    2983129822      fill_value=gen.fillValueI)
     
    2983429825    innewvar.setncattr('coordinates',' '.join(Srgrid[::-1]))
    2983529826
    29836     print 'Lluis file creation 2'
    29837 
    2983829827    aanewvar = onewnc.createVariable(dn+'area','f',tuple(Srgrid),                    \
    2983929828      fill_value=gen.fillValueF)
     
    2984229831    aanewvar.setncattr('coordinates',' '.join(Srgrid[::-1]))
    2984329832
    29844     print 'Lluis file creation 3'
    29845 
    2984629833    anewvar = onewnc.createVariable(dn+'gridarea','f',tuple(Spgrid),                 \
    2984729834      fill_value=gen.fillValueF)
     
    2985029837    anewvar.setncattr('coordinates',' '.join(Spgrid[::-1]))
    2985129838
    29852     print 'Lluis file creation 4'
    29853 
    2985429839    pnewvar = onewnc.createVariable(dn+'gridpercen','f',tuple(Spgrid),               \
    2985529840      fill_value=gen.fillValueF)
     
    2985729842      "grids cells from " + newslcvarns[0] + " laying within " + newslcvarns[1], '1')
    2985829843    pnewvar.setncattr('coordinates',' '.join(Spgrid[::-1]))
    29859 
    29860     print 'Lluis prior to... dyA, dxA, dyB, dxB', dyA, dxA, dyB, dxB
    2986129844
    2986229845    for jA in range(dyA):
     
    2989629879    #onewnc.close()
    2989729880    #quit()
    29898 
    29899     print 'Lluis here !!'
    2990029881
    2990129882    if Nnewslcs >= 3:
Note: See TracChangeset for help on using the changeset viewer.