code: def write_gtiff_file(f_name, n_rows, n_cols, data, geotransform, srs, nodata_value,
                           gdal_type=GDT_Float32):
          
          UtilClass.mkdir(os.path.dirname(FileClass.get_file_fullpath(f_name)))
          driver = gdal_GetDriverByName(str('GTiff'))
          try:
              ds = driver.Create(f_name, n_cols, n_rows, 1, gdal_type)
          except Exception:
              print('Cannot create output file %s' % f_name)
              return
          ds.SetGeoTransform(geotransform)
          try:
              ds.SetProjection(srs.ExportToWkt())
          except AttributeError or Exception:
              ds.SetProjection(srs)
          ds.GetRasterBand(1).SetNoDataValue(nodata_value)
          # if data contains numpy.nan, then replaced by nodata_value
          if isinstance(data, numpy.ndarray) and data.dtype in [numpy.dtype('int'),
                                                                numpy.dtype('float')]:
              data = numpy.where(numpy.isnan(data), nodata_value, data)
          ds.GetRasterBand(1).WriteArray(data)
          ds = None
docs: Output Raster to GeoTiff format file.
  
          Args:
              f_name: output gtiff file name.
              n_rows: Row count.
              n_cols: Col count.
              data: 2D array data.
              geotransform: geographic transformation.
              srs: coordinate system.
              nodata_value: nodata value.
              gdal_type (:obj:`pygeoc.raster.GDALDataType`): output raster data type,
                                                                    GDT_Float32 as default.