77from shapely .geometry import Point
88import geopandas
99
10- from pygridtools import iotools
11- from pygridtools import misc
1210from pygridtools import validate
1311
1412
@@ -93,7 +91,7 @@ def write_cellinp(cell_array, outputfile='cell.inp', mode='w',
9391 nrows , ncols = cell_array .shape
9492
9593 rowfmt = '{0:3d} {1:s}\n '
96- colfmt = f'{{:0{ _n_digits (ncols )} d}}'
94+ # colfmt = f'{{:0{_n_digits(ncols)}d}}'
9795
9896 if cell_array .shape [1 ] > maxcols :
9997 first_array = cell_array [:, :maxcols ]
@@ -108,7 +106,7 @@ def write_cellinp(cell_array, outputfile='cell.inp', mode='w',
108106
109107 else :
110108 columns = numpy .arange (1 , maxcols + 1 , dtype = int )
111- colstr = [list ('{ :04d}'. format ( c ) ) for c in columns ]
109+ colstr = [list (f' { c :04d} ' ) for c in columns ]
112110 hundreds = '' .join ([c [1 ] for c in colstr ])
113111 tens = '' .join ([c [2 ] for c in colstr ])
114112 ones = '' .join ([c [3 ] for c in colstr ])
@@ -117,19 +115,16 @@ def write_cellinp(cell_array, outputfile='cell.inp', mode='w',
117115 if writeheader :
118116 title = 'C -- cell.inp for EFDC model by pygridtools\n '
119117 outfile .write (title )
120- outfile .write ('C {} \n ' . format ( hundreds [:ncols ]) )
121- outfile .write ('C {} \n ' . format ( tens [:ncols ]) )
122- outfile .write ('C {} \n ' . format ( ones [:ncols ]) )
118+ outfile .write (f 'C { hundreds [:ncols ]} \n ' )
119+ outfile .write (f 'C { tens [:ncols ]} \n ' )
120+ outfile .write (f 'C { ones [:ncols ]} \n ' )
123121
124122 for n , row in enumerate (cell_array ):
125123 row_number = nrows - n
126124 row_strings = row .astype (str )
127125 cell_text = '' .join (row_strings .tolist ())
128- if rowlabels :
129- rowheader = ''
130- row_text = rowfmt .format (int (row_number ), cell_text )
131- else :
132- row_text = ' {0:s}\n ' .format (cell_text )
126+
127+ row_text = rowfmt .format (int (row_number ), cell_text ) if rowlabels else f' { cell_text :s} \n '
133128
134129 outfile .write (row_text )
135130
@@ -153,7 +148,7 @@ def write_gridout_file(xcoords, ycoords, outfile):
153148 })
154149
155150 with Path (outfile ).open ('w' ) as f :
156- f .write ('## {:d} x {:d}\n ' . format ( nx , ny ) )
151+ f .write (f '## { nx :d} x { ny :d} \n ' )
157152
158153 # XXX: https://github.com/pandas-dev/pandas/issues/21882
159154 with Path (outfile ).open ('a' ) as f :
@@ -295,8 +290,8 @@ def make_gefdc_cells(node_mask, cell_mask=None, triangles=False):
295290 if total == bank_cell * shift ** 2 :
296291 cells [cj , ci ] = land_cell
297292
298- nrows = cells .shape [0 ]
299- ncols = cells .shape [1 ]
293+ # nrows = cells.shape[0]
294+ # ncols = cells.shape[1]
300295
301296 # nchunks = numpy.ceil(ncols / maxcols)
302297 # if ncols > maxcols:
0 commit comments