@@ -146,7 +146,7 @@ |
List<ERU> hrus_all = new ArrayList<>(); |
HashMap<Integer, ArrayList<Nass_results>> nass_data_result_all = new HashMap<>(); |
|
- PrintWriter w_log = new PrintWriter(new OutputStreamWriter(System.out)); |
+ //PrintWriter w_log = new PrintWriter(new OutputStreamWriter(System.out)); |
|
LOG.info("===> Processing entities."); |
|
@@ -154,17 +154,17 @@ |
|
LOG.info("===> Reading AOI"); |
|
- hrus_pre = CSIP_Read_Geometry.URL_Read_Geometry_File_new(dataDir, geomUrl, Input_Geometries_pre, workspace, unique_states, unique_cmzs, envelope, w_log); |
+ hrus_pre = CSIP_Read_Geometry.URL_Read_Geometry_File_new(dataDir, geomUrl, Input_Geometries_pre, workspace, unique_states, unique_cmzs, envelope, LOG); |
|
ArrayList<ArrayList<String>> LMOD_CMZ_Data = new ArrayList<>(); |
HashMap<String, List<ArrayList<String>>> DB_LMOD_map = new HashMap<>(); |
|
- CSIP_NASS_LMOD_Matching.query_LAMPS_DB_Rotations_For_CMZ(dataDir, unique_cmzs, LMOD_CMZ_Data, DB_LMOD_map, w_log); |
+ CSIP_NASS_LMOD_Matching.query_LAMPS_DB_Rotations_For_CMZ(dataDir, unique_cmzs, LMOD_CMZ_Data, DB_LMOD_map, LOG); |
|
LOG.info("===> Check available NASS years."); |
|
if (CDL_years.isEmpty()) { |
- CDL_years = CSIP_NASS_GeoTIFF.NASS_CDL_YEARS_CHECK(dataDir, unique_states, w_log); |
+ CDL_years = CSIP_NASS_GeoTIFF.NASS_CDL_YEARS_CHECK(dataDir, unique_states); |
} |
Collections.sort(CDL_years); |
LOG.info(" Available NASS CDL year(s) for State with longest time period : "); |
@@ -176,7 +176,7 @@ |
LOG.info("===> Irrigation clipping."); |
|
HashMap<Integer, ArrayList<HashMap<Integer, Double>>> irrigation_map = null; |
- irrigation_map = CSIP_NASS_GeoTIFF.ConcurrentIrrigation_Overlay(dataDir, Input_Geometries_pre, w_log); |
+ irrigation_map = CSIP_NASS_GeoTIFF.ConcurrentIrrigation_Overlay(dataDir, Input_Geometries_pre, LOG); |
LOG.info("===> Irrigation clipping done."); |
LOG.info(" "); |
|
@@ -238,7 +238,7 @@ |
LOG.info("===> NASS clipping."); |
|
HashMap<Integer, ArrayList<Nass_results>> nass_data_result = null; |
- nass_data_result = CSIP_NASS_GeoTIFF.NASSGeoTIFF_clip_analysis(dataDir, CDLdataDirlocation, outputDir, CDL_years, Input_Geometries, hrus, unique_states, geotiffs, w_log); |
+ nass_data_result = CSIP_NASS_GeoTIFF.NASSGeoTIFF_clip_analysis(dataDir, CDLdataDirlocation, outputDir, CDL_years, Input_Geometries, hrus, unique_states, geotiffs, LOG); |
|
for (int i = 0; i < hrus.size(); i++) { |
hrus.get(i).nass_list_data = nass_data_result.get(i); |
@@ -264,15 +264,14 @@ |
|
LOG.info("===> Going to the Confidence."); |
|
- CSIP_NASS_LMOD.NASS_data_CropSeq(dataDir, hrus, delta, w_log); |
+ CSIP_NASS_LMOD.NASS_data_CropSeq(dataDir, hrus, delta, LOG); |
|
LOG.info("===> Done Confidence."); |
|
LOG.info("===> Going to the Matching."); |
|
HashMap<Integer, ArrayList<String[]>> map = new HashMap<>(); |
- map = CSIP_NASS_LMOD_Matching.ConcurrentMatching(dataDir, hrus, |
- CDL_years, LMOD_CMZ_Data, DB_LMOD_map, start_year, end_year, w_log); |
+ map = CSIP_NASS_LMOD_Matching.ConcurrentMatching(dataDir, hrus, CDL_years, LMOD_CMZ_Data, DB_LMOD_map, start_year, end_year, LOG); |
|
LOG.info("===> Done with the Matching."); |
|
@@ -289,13 +288,13 @@ |
|
LOG.info("===> Output generation."); |
|
- CSIP_NASS_LMOD.NASS_data_check(outputDir, hrus_all, nass_data_result_all, w_log); |
+ CSIP_NASS_LMOD.NASS_data_check(outputDir, hrus_all, nass_data_result_all, LOG); |
|
- CSIP_PLAIN_NASS_DATA_WRITER.PLAIN_NASS_data_writer(outputDir, hrus_all, nass_data_result_all, w_log); |
+ CSIP_PLAIN_NASS_DATA_WRITER.PLAIN_NASS_data_writer(outputDir, hrus_all, nass_data_result_all, LOG); |
nass_data_result_all.clear(); |
System.gc(); |
|
- CSIP_NASS_LMOD_Matching.AOI_NASS_LMOD_generic_match_data_writer(outputDir, hrus_all, irrigation_map, delta, w_log); |
+ CSIP_NASS_LMOD_Matching.AOI_NASS_LMOD_generic_match_data_writer(outputDir, hrus_all, irrigation_map, delta, LOG); |
|
irrigation_map.clear(); |
System.gc(); |
@@ -313,10 +312,10 @@ |
HashMap<String, String[]> OP_map_tillage = new HashMap<>(); |
HashMap<String, String[]> DB_map_managements_acr = new HashMap<>(); |
|
- CSIP_NASS_LMOD_Matching.AOI_NASS_DETECTED_LMODDATA_PREPARATION(dataDir, hrus_all, DB_map_managements, Unique_LMOD_OPKEYs, Unique_LMOD_ManKEYs, managements, OP_map_costum, DB_map_managements_acr, OP_map_tillage, LMOD_AGES_CID_map, only_veg_map, w_log); |
+ CSIP_NASS_LMOD_Matching.AOI_NASS_DETECTED_LMODDATA_PREPARATION(dataDir, hrus_all, DB_map_managements, Unique_LMOD_OPKEYs, Unique_LMOD_ManKEYs, managements, OP_map_costum, DB_map_managements_acr, OP_map_tillage, LMOD_AGES_CID_map, only_veg_map, LOG); |
|
if (custom) { |
- CSIP_NASS_LMOD_Matching.AOI_NASS_LMODDATA_costum_generic_writer(outputDir, hrus_all, DB_map_managements, managements, OP_map_costum, DB_map_managements_acr, LMOD_AGES_MID_map, only_veg_map, start_year, end_year, w_log); |
+ CSIP_NASS_LMOD_Matching.AOI_NASS_LMODDATA_costum_generic_writer(outputDir, hrus_all, DB_map_managements, managements, OP_map_costum, DB_map_managements_acr, LMOD_AGES_MID_map, only_veg_map, start_year, end_year, LOG); |
} |
|
managements.clear(); |
@@ -326,8 +325,8 @@ |
if (ages_files) { |
LOG.info("===> Output generation. AgES-W input files"); |
|
- CSIP_AGESW_FILES.AGES_TillageFile_data_writer(outputDir, OP_map_tillage, OP_Till_Man, w_log); |
- CSIP_AGESW_FILES.AGES_ManagementFile_data_writer(outputDir, hrus_all, OP_Till_Man, DB_map_managements, DB_map_managements_acr, LMOD_AGES_CID_map, LMOD_AGES_MID_map, only_veg_map, w_log); |
+ CSIP_AGESW_FILES.AGES_TillageFile_data_writer(outputDir, OP_map_tillage, OP_Till_Man); |
+ CSIP_AGESW_FILES.AGES_ManagementFile_data_writer(outputDir, hrus_all, OP_Till_Man, DB_map_managements, DB_map_managements_acr, LMOD_AGES_CID_map, LMOD_AGES_MID_map, only_veg_map); |
} |
|
LOG.info("Finished."); |
@@ -7,9 +7,9 @@ |
import com.vividsolutions.jts.geom.Geometry; |
import com.vividsolutions.jts.geom.MultiPolygon; |
import com.vividsolutions.jts.geom.Polygon; |
+import csip.SessionLogger; |
import java.io.File; |
import java.io.IOException; |
-import java.io.PrintWriter; |
import java.net.MalformedURLException; |
import java.net.URL; |
import java.util.ArrayList; |
@@ -52,7 +52,7 @@ |
* @throws InterruptedException |
* @throws ExecutionException |
*/ |
- public static List<ERU> States_CMZs_intersect_fast(File dataDir, ReferencedEnvelope env, List<Geometry> AOI, Geometry multigeo, PrintWriter w_log) throws MalformedURLException, IOException, InterruptedException, ExecutionException { |
+ public static List<ERU> States_CMZs_intersect_fast(File dataDir, ReferencedEnvelope env, List<Geometry> AOI, Geometry multigeo, SessionLogger LOG) throws MalformedURLException, IOException, InterruptedException, ExecutionException { |
List<ERU> local_hrus = new ArrayList<>(); |
|
ArrayList<String> states = new ArrayList<>(); |
@@ -117,12 +117,14 @@ |
} |
} |
} |
- w_log.println("===> Done rough State check. " + states.size()); |
+ //w_log.println("===> Done rough State check. " + states.size()); |
+ LOG.info("===> Done rough State check. " + states.size()); |
|
for (int i = 0; i < states.size(); i++) { |
- w_log.println(i + " " + states.get(i)); |
+ //w_log.println(i + " " + states.get(i)); |
+ LOG.info(i + " " + states.get(i)); |
} |
- w_log.flush(); |
+ //w_log.flush(); |
|
featureIterator.close(); |
|
@@ -191,11 +193,13 @@ |
} |
featureIterator.close(); |
|
- w_log.println("===> Done rough CMZ check. " + CMZs.size()); |
+ //w_log.println("===> Done rough CMZ check. " + CMZs.size()); |
+ LOG.info("===> Done rough CMZ check. " + CMZs.size()); |
for (int i = 0; i < CMZs.size(); i++) { |
- w_log.println(i + " " + CMZs.get(i)); |
+ //w_log.println(i + " " + CMZs.get(i)); |
+ LOG.info(i + " " + CMZs.get(i)); |
} |
- w_log.flush(); |
+ //w_log.flush(); |
|
//--------------Counties |
featureIterator.close(); |
@@ -240,11 +244,13 @@ |
} |
featureIterator.close(); |
|
- w_log.println("===> Done rough County check. " + County.size()); |
+ //w_log.println("===> Done rough County check. " + County.size()); |
+ LOG.info("===> Done rough County check. " + County.size()); |
for (int i = 0; i < County.size(); i++) { |
- w_log.println(i + " " + County.get(i)); |
+ //w_log.println(i + " " + County.get(i)); |
+ LOG.info(i + " " + County.get(i)); |
} |
- w_log.flush(); |
+ //w_log.flush(); |
|
if (CMZs.size() < 2 && states.size() < 2 && County.size() < 2) { |
for (int i = 0; i < AOI.size(); i++) { |
@@ -262,11 +268,12 @@ |
} |
|
} else { |
- local_hrus = ConcurrentOverlay(AOI, geo_list_cmzs, geo_list_states, geo_list_county, w_log); |
+ local_hrus = ConcurrentOverlay(AOI, geo_list_cmzs, geo_list_states, geo_list_county, LOG); |
} |
|
- w_log.println("===> Done State & CMZ & County check for all " + local_hrus.size()); |
- w_log.flush(); |
+ //w_log.println("===> Done State & CMZ & County check for all " + local_hrus.size()); |
+ LOG.info("===> Done State & CMZ & County check for all " + local_hrus.size()); |
+ //w_log.flush(); |
return local_hrus; |
} |
|
@@ -281,7 +288,7 @@ |
* @throws InterruptedException |
* @throws ExecutionException |
*/ |
- public static List<ERU> ConcurrentOverlay(List<Geometry> AOI, ArrayList<SimpleFeature> list_cmzs, ArrayList<SimpleFeature> list_states, ArrayList<SimpleFeature> list_county, PrintWriter w_log) throws InterruptedException, ExecutionException { |
+ public static List<ERU> ConcurrentOverlay(List<Geometry> AOI, ArrayList<SimpleFeature> list_cmzs, ArrayList<SimpleFeature> list_states, ArrayList<SimpleFeature> list_county, SessionLogger LOG) throws InterruptedException, ExecutionException { |
|
int threadnr = 1; |
if (AOI.size() > 30) { |
@@ -298,7 +305,7 @@ |
final ArrayList<SimpleFeature> fin_coll_states = list_states; |
final ArrayList<SimpleFeature> fin_coll_cmz = list_cmzs; |
final ArrayList<SimpleFeature> fin_coll_county = list_county; |
- final PrintWriter fPW = w_log; |
+ final SessionLogger fSL = LOG; |
|
final int p = (last + 1) / threadNum; |
int s = (last + 1) - p * threadNum; |
@@ -315,7 +322,7 @@ |
|
@Override |
public List<ERU> call() throws Exception { |
- return CSIP_Georeferencing.Overlay(infirst, inlast, AOI_fin, fin_coll_cmz, fin_coll_states, fin_coll_county, ii, fPW); |
+ return CSIP_Georeferencing.Overlay(infirst, inlast, AOI_fin, fin_coll_cmz, fin_coll_states, fin_coll_county, ii, fSL); |
} |
}); |
taskList.add(futureTask_1); |
@@ -342,10 +349,11 @@ |
* @param list_states |
* @param list_county |
* @param part |
+ * @param LOG |
* @param w_log |
* @return |
*/ |
- public static List<ERU> Overlay(int first, int last, List<Geometry> AOI, ArrayList<SimpleFeature> list_cmzs, ArrayList<SimpleFeature> list_states, ArrayList<SimpleFeature> list_county, int part, PrintWriter w_log) { |
+ public static List<ERU> Overlay(int first, int last, List<Geometry> AOI, ArrayList<SimpleFeature> list_cmzs, ArrayList<SimpleFeature> list_states, ArrayList<SimpleFeature> list_county, int part, SessionLogger LOG) { |
|
int count = 0; |
|
@@ -369,8 +377,9 @@ |
count = 0; |
double progress = ((double) i - first) / ((double) part_all); |
progress = (double) progress * 100.00; |
- w_log.println(part + ".-" + ((int) progress) + "%..."); |
- w_log.flush(); |
+ //w_log.println(part + ".-" + ((int) progress) + "%..."); |
+ LOG.info(part + ".-" + ((int) progress) + "%..."); |
+ //w_log.flush(); |
} |
|
for (SimpleFeature feature : list_cmzs) { |
@@ -492,8 +501,9 @@ |
} |
new_hru.county = counties; |
if (new_hru.county.isEmpty()) { |
- w_log.println("===> No County " + new_hru.ID); |
- w_log.flush(); |
+ //w_log.println("===> No County " + new_hru.ID); |
+ LOG.info("===> No County " + new_hru.ID); |
+ //w_log.flush(); |
} |
} |
|
@@ -530,8 +540,9 @@ |
} |
new_hru.state = states; |
if (new_hru.state.isEmpty()) { |
- w_log.println("===> No State " + new_hru.ID); |
- w_log.flush(); |
+ //w_log.println("===> No State " + new_hru.ID); |
+ LOG.info("===> No State " + new_hru.ID); |
+ //w_log.flush(); |
} |
} |
|
@@ -549,8 +560,9 @@ |
} |
new_hru.cmz = CMZs; |
if (new_hru.cmz.isEmpty()) { |
- w_log.println("===> No CMZ " + new_hru.ID); |
- w_log.flush(); |
+ //w_log.println("===> No CMZ " + new_hru.ID); |
+ LOG.info("===> No CMZ " + new_hru.ID); |
+ //w_log.flush(); |
CMZs.add("XX"); |
} |
} |
@@ -10,6 +10,7 @@ |
import com.vividsolutions.jts.geom.Polygon; |
import com.vividsolutions.jts.simplify.DouglasPeuckerSimplifier; |
import com.vividsolutions.jts.simplify.TopologyPreservingSimplifier; |
+import csip.SessionLogger; |
import java.awt.Rectangle; |
import java.awt.geom.AffineTransform; |
import java.io.File; |
@@ -334,7 +335,7 @@ |
* @throws InterruptedException |
* @throws ExecutionException |
*/ |
- public static ArrayList<Nass_results> ConcurrentGeoTIFF_Clipping(List<String> CDL_years, List<Geometry> Input_Geometries, HashMap<Integer, String> map, File dataDir, File outputDir, boolean geotiffs, PrintWriter w_log) throws InterruptedException, ExecutionException { |
+ public static ArrayList<Nass_results> ConcurrentGeoTIFF_Clipping(List<String> CDL_years, List<Geometry> Input_Geometries, HashMap<Integer, String> map, File dataDir, File outputDir, boolean geotiffs, SessionLogger LOG) throws InterruptedException, ExecutionException { |
|
int threadnr = 1; |
if (Input_Geometries.size() > 30) { |
@@ -351,7 +352,7 @@ |
final List<String> years = CDL_years; |
final HashMap<Integer, String> fmap = map; |
final List<Geometry> fG = Input_Geometries; |
- final PrintWriter fPW = w_log; |
+ final SessionLogger fSL = LOG; |
final File oD = outputDir; |
final File dD = dataDir; |
final boolean fgeotiffs = geotiffs; |
@@ -372,7 +373,7 @@ |
|
@Override |
public ArrayList<Nass_results> call() throws Exception { |
- return CSIP_NASS_GeoTIFF.NASS_GeoTIFF_clipping(infirst, inlast, fmap, years, fG, dD, oD, fgeotiffs, fPW); |
+ return CSIP_NASS_GeoTIFF.NASS_GeoTIFF_clipping(infirst, inlast, fmap, years, fG, dD, oD, fgeotiffs, fSL); |
} |
}); |
taskList.add(futureTask_1); |
@@ -394,14 +395,13 @@ |
* |
* @param dataDir |
* @param Input_Geometries |
- * @param w_log |
* @return |
* @throws InterruptedException |
* @throws ExecutionException |
* @throws java.net.MalformedURLException |
* @throws java.io.IOException |
*/ |
- public static HashMap<Integer, ArrayList<HashMap<Integer, Double>>> ConcurrentIrrigation_Overlay(File dataDir, List<Geometry> Input_Geometries, PrintWriter w_log) |
+ public static HashMap<Integer, ArrayList<HashMap<Integer, Double>>> ConcurrentIrrigation_Overlay(File dataDir, List<Geometry> Input_Geometries, SessionLogger LOG) |
throws InterruptedException, ExecutionException, MalformedURLException, IllegalArgumentException, IOException { |
|
//final int threadNum = CSIP_Const.Number_of_Irrigation_tifs; |
@@ -425,14 +425,14 @@ |
|
final File dD = dataDir; |
final List<Geometry> fG = Input_Geometries; |
- final PrintWriter fPW = w_log; |
int years_size = years.length; |
|
for (int i = 0, year_size = years_size; i < year_size; i++) { |
final int pos = i; |
long start_time = System.currentTimeMillis(); |
- w_log.println(" year: " + years[pos]); |
- w_log.flush(); |
+ //w_log.println(" year: " + years[pos]); |
+ LOG.info(" year: " + years[pos]); |
+ //w_log.flush(); |
// Prepare to execute and store the Futures |
ExecutorService executor = Executors.newFixedThreadPool(threadNum); |
List<FutureTask<HashMap<Integer, Double>>> taskList = new ArrayList<>(); |
@@ -444,7 +444,7 @@ |
|
@Override |
public HashMap<Integer, Double> call() throws Exception { |
- return CSIP_NASS_GeoTIFF.IRRIGATION_clip_analysis(infirst, inlast, pos, dD, fG, years[pos], fPW); |
+ return CSIP_NASS_GeoTIFF.IRRIGATION_clip_analysis(infirst, inlast, pos, dD, fG, years[pos]); |
} |
}); |
taskList.add(futureTask_1); |
@@ -475,8 +475,9 @@ |
executor.shutdown(); |
long end_time = System.currentTimeMillis(); |
double difference = (end_time - start_time) / 1000; |
- w_log.println(" Irrigation raster duration: " + difference + " s"); |
- w_log.flush(); |
+ //w_log.println(" Irrigation raster duration: " + difference + " s"); |
+ LOG.info(" Irrigation raster duration: " + difference + " s"); |
+ //w_log.flush(); |
} |
return result_map; |
} |
@@ -485,12 +486,12 @@ |
* |
* @param dataDir |
* @param st |
- * @param w_log |
+ * @param LOG |
* @return |
* @throws ClassNotFoundException |
* @throws SQLException |
*/ |
- public static List<String> NASS_CDL_YEARS_CHECK(File dataDir, List<String> st, PrintWriter w_log) throws ClassNotFoundException, SQLException { |
+ public static List<String> NASS_CDL_YEARS_CHECK(File dataDir, List<String> st) throws ClassNotFoundException, SQLException { |
Class.forName("org.h2.Driver"); |
List<String> years; |
int smallest = 9000; |
@@ -562,12 +563,11 @@ |
/** |
* |
* @param dataDir |
- * @param w_log |
* @return |
* @throws ClassNotFoundException |
* @throws SQLException |
*/ |
- public static HashMap<Integer, String> DB_Query_NASS_Raster_IDs(File dataDir, PrintWriter w_log) throws ClassNotFoundException, SQLException { |
+ public static HashMap<Integer, String> DB_Query_NASS_Raster_IDs(File dataDir) throws ClassNotFoundException, SQLException { |
|
HashMap<Integer, String> map = new HashMap<>(); |
Class.forName("org.h2.Driver"); |
@@ -589,13 +589,12 @@ |
* @param dataDir |
* @param allcrops |
* @param states |
- * @param w_log |
* @return |
* @throws IOException |
* @throws ClassNotFoundException |
* @throws SQLException |
*/ |
- public static HashMap<String, ArrayList<Nass_accurcies>> DB_nassaccu(File dataDir, ArrayList<String> allcrops, List<String> states, PrintWriter w_log) throws IOException, ClassNotFoundException, SQLException { |
+ public static HashMap<String, ArrayList<Nass_accurcies>> DB_nassaccu(File dataDir, ArrayList<String> allcrops, List<String> states) throws IOException, ClassNotFoundException, SQLException { |
|
HashMap<String, ArrayList<Nass_accurcies>> prep_map = new HashMap<>(); |
|
@@ -687,13 +686,12 @@ |
* @param dataDir |
* @param Input_Geometries |
* @param ye |
- * @param w_log |
* @return |
* @throws MalformedURLException |
* @throws IllegalArgumentException |
* @throws IOException |
*/ |
- public static HashMap<Integer, Double> IRRIGATION_clip_analysis(int first, int last, int pos, File dataDir, List<Geometry> Input_Geometries, String ye, PrintWriter w_log) throws MalformedURLException, IllegalArgumentException, IOException { |
+ public static HashMap<Integer, Double> IRRIGATION_clip_analysis(int first, int last, int pos, File dataDir, List<Geometry> Input_Geometries, String ye) throws MalformedURLException, IllegalArgumentException, IOException { |
HashMap<Integer, Double> map = new HashMap<>(); |
|
Crop ImageCrop = new Crop(); |
@@ -820,7 +818,6 @@ |
} |
} |
|
- w_log.flush(); |
return map; |
} |
|
@@ -834,6 +831,7 @@ |
* @param hrus |
* @param unique_states |
* @param geotiffs |
+ * @param LOG |
* @param w_log |
* @return |
* @throws IOException |
@@ -843,23 +841,27 @@ |
* @throws InterruptedException |
* @throws ExecutionException |
*/ |
- public static HashMap<Integer, ArrayList<Nass_results>> NASSGeoTIFF_clip_analysis(File dataDir, File CDLdataDir, File outputDir, List<String> years, List<Geometry> Input_Geometries, List<ERU> hrus, List<String> unique_states, boolean geotiffs, PrintWriter w_log) throws IOException, URISyntaxException, ClassNotFoundException, SQLException, InterruptedException, ExecutionException { |
+ public static HashMap<Integer, ArrayList<Nass_results>> NASSGeoTIFF_clip_analysis(File dataDir, File CDLdataDir, File outputDir, List<String> years, List<Geometry> Input_Geometries, List<ERU> hrus, List<String> unique_states, boolean geotiffs, SessionLogger LOG) throws IOException, URISyntaxException, ClassNotFoundException, SQLException, InterruptedException, ExecutionException { |
|
- w_log.println(" "); |
- w_log.println("GeoTIFFs clip & analysis...."); |
- w_log.println(" ERUs " + hrus.size() + " and " + years.size() + " years"); |
- w_log.flush(); |
- |
+// w_log.println(" "); |
+// w_log.println("GeoTIFFs clip & analysis...."); |
+// w_log.println(" ERUs " + hrus.size() + " and " + years.size() + " years"); |
+// w_log.flush(); |
+ LOG.info(" "); |
+ LOG.info("GeoTIFFs clip & analysis...."); |
+ LOG.info(" ERUs " + hrus.size() + " and " + years.size() + " years"); |
+ |
HashMap<Integer, String> NASS_map = new HashMap<>(); |
- NASS_map = CSIP_NASS_GeoTIFF.DB_Query_NASS_Raster_IDs(dataDir, w_log); |
+ NASS_map = CSIP_NASS_GeoTIFF.DB_Query_NASS_Raster_IDs(dataDir); |
|
ArrayList<Nass_results> cropslist = new ArrayList<>(); |
|
- cropslist = CSIP_NASS_GeoTIFF.ConcurrentGeoTIFF_Clipping(years, Input_Geometries, NASS_map, CDLdataDir, outputDir, geotiffs, w_log); |
+ cropslist = CSIP_NASS_GeoTIFF.ConcurrentGeoTIFF_Clipping(years, Input_Geometries, NASS_map, CDLdataDir, outputDir, geotiffs, LOG); |
//cropslist.add(new Nass_results(years.get(i), y, simpleP.getArea(), clip_size, crops_names, crops_area, is_crop, crops_area)); |
//y++; |
- w_log.println(" Done GeoTIFF Clipping"); |
- w_log.flush(); |
+ //w_log.println(" Done GeoTIFF Clipping"); |
+ LOG.info(" Done GeoTIFF Clipping"); |
+ //w_log.flush(); |
|
List<Nass_results> NASS_list = null; |
NASS_list = cropslist; |
@@ -877,8 +879,9 @@ |
hru.nass_plain_list = NASS_print_list; |
} |
|
- w_log.println(" Done NASS List; size: " + cropslist.size()); |
- w_log.flush(); |
+ //w_log.println(" Done NASS List; size: " + cropslist.size()); |
+ LOG.info(" Done NASS List; size: " + cropslist.size()); |
+ //w_log.flush(); |
|
ArrayList<String> all_crops = null; |
all_crops = new ArrayList<>(); |
@@ -893,25 +896,29 @@ |
} |
} |
|
- w_log.println(" " + all_crops.size() + " different crops/vegatation/landuses found."); |
- w_log.flush(); |
+ //w_log.println(" " + all_crops.size() + " different crops/vegatation/landuses found."); |
+ LOG.info(" " + all_crops.size() + " different crops/vegatation/landuses found."); |
+ //w_log.flush(); |
|
HashMap<String, ArrayList<Nass_accurcies>> map = new HashMap<>(); |
|
- map = CSIP_NASS_GeoTIFF.DB_nassaccu(dataDir, all_crops, unique_states, w_log); |
+ map = CSIP_NASS_GeoTIFF.DB_nassaccu(dataDir, all_crops, unique_states); |
|
HashMap<Integer, ArrayList<Nass_results>> ALL_HRU_CROPS = new HashMap(); |
|
- ALL_HRU_CROPS = CSIP_NASS_GeoTIFF.ConcurrentHRU_NASS(map, cropslist, hrus, w_log); |
+ ALL_HRU_CROPS = CSIP_NASS_GeoTIFF.ConcurrentHRU_NASS(map, cropslist, hrus); |
map = null; |
|
- w_log.println(" "); |
- w_log.println("Dominat NASS crops/vegetations linked to HRUs."); |
- w_log.flush(); |
+// w_log.println(" "); |
+// w_log.println("Dominat NASS crops/vegetations linked to HRUs."); |
+// w_log.flush(); |
+ LOG.info(" "); |
+ LOG.info("Dominat NASS crops/vegetations linked to HRUs."); |
+ //w_log.flush(); |
return ALL_HRU_CROPS; |
} |
|
- public static ArrayList<Nass_results> NASS_GeoTIFF_clipping(int first, int last, HashMap<Integer, String> map, List<String> years, List<Geometry> Input_Geometries, File dataDir, File outputDir, boolean geotiffs, PrintWriter w_log) throws IllegalArgumentException, IOException, ExecutionException, FactoryException { |
+ public static ArrayList<Nass_results> NASS_GeoTIFF_clipping(int first, int last, HashMap<Integer, String> map, List<String> years, List<Geometry> Input_Geometries, File dataDir, File outputDir, boolean geotiffs, SessionLogger LOG) throws IllegalArgumentException, IOException, ExecutionException, FactoryException { |
|
ArrayList<Nass_results> cropslist = new ArrayList<>(); |
|
@@ -926,8 +933,9 @@ |
for (int i = first; i <= last; i++) { |
File NASS_file = new File(dataDir, "NASS_" + years.get(i) + ".tif"); |
if (NASS_file.exists()) { |
- w_log.println(" Processing year: " + years.get(i)); |
- w_log.flush(); |
+ //w_log.println(" Processing year: " + years.get(i)); |
+ LOG.info(" Processing year: " + years.get(i)); |
+ //w_log.flush(); |
|
GridCoverage2DReader reader = new GeoTiffReader(NASS_file, new Hints(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER, Boolean.TRUE)); |
|
@@ -1104,8 +1112,9 @@ |
int cc = 0; |
for (Map.Entry<Integer, Integer> entry : Pixel_NASSID_map.entrySet()) { |
if (map.get(entry.getKey()).isEmpty() || map.get(entry.getKey()).equals("null")) { |
- w_log.println("HRU " + y + " Pixel ID " + entry.getKey() + " no crop name in year: " + years.get(i)); |
- w_log.flush(); |
+ //w_log.println("HRU " + y + " Pixel ID " + entry.getKey() + " no crop name in year: " + years.get(i)); |
+ LOG.info("HRU " + y + " Pixel ID " + entry.getKey() + " no crop name in year: " + years.get(i)); |
+ //w_log.flush(); |
} else { |
crops_names[cc] = map.get(entry.getKey()); |
crops_area[cc] = (double) entry.getValue() * (cell_size * cell_size); |
@@ -1118,8 +1127,9 @@ |
|
} |
} |
- w_log.println(" Done year: " + years.get(i)); |
- w_log.flush(); |
+ //w_log.println(" Done year: " + years.get(i)); |
+ LOG.info(" Done year: " + years.get(i)); |
+ //w_log.flush(); |
} |
return cropslist; |
} |
@@ -1134,7 +1144,7 @@ |
* @throws InterruptedException |
* @throws ExecutionException |
*/ |
- public static HashMap<Integer, ArrayList<Nass_results>> ConcurrentHRU_NASS(HashMap<String, ArrayList<Nass_accurcies>> map, ArrayList<Nass_results> cropslist, List<ERU> hrus, PrintWriter w_log) |
+ public static HashMap<Integer, ArrayList<Nass_results>> ConcurrentHRU_NASS(HashMap<String, ArrayList<Nass_accurcies>> map, ArrayList<Nass_results> cropslist, List<ERU> hrus) |
throws InterruptedException, ExecutionException { |
|
int threadnr = 1; |
@@ -1152,8 +1162,6 @@ |
final HashMap<String, ArrayList<Nass_accurcies>> fmap = map; |
final ArrayList<Nass_results> fcroplist = cropslist; |
final List<ERU> fHRU = hrus; |
- final PrintWriter fPW = w_log; |
- |
final int p = (last + 1) / threadNum; |
int s = (last + 1) - p * threadNum; |
|
@@ -1170,7 +1178,7 @@ |
|
@Override |
public HashMap<Integer, ArrayList<Nass_results>> call() throws Exception { |
- return CSIP_NASS_GeoTIFF.HRU_NASS_GeoTIFF(infirst, inlast, fmap, fcroplist, fHRU, fPW); |
+ return CSIP_NASS_GeoTIFF.HRU_NASS_GeoTIFF(infirst, inlast, fmap, fcroplist, fHRU); |
} |
}); |
taskList.add(futureTask_1); |
@@ -1203,7 +1211,7 @@ |
* @throws IllegalArgumentException |
* @throws IOException |
*/ |
- public static HashMap<Integer, ArrayList<Nass_results>> HRU_NASS_GeoTIFF(int first, int last, HashMap<String, ArrayList<Nass_accurcies>> map, ArrayList<Nass_results> cropslist, List<ERU> hrus, PrintWriter w_log) throws IllegalArgumentException, IOException { |
+ public static HashMap<Integer, ArrayList<Nass_results>> HRU_NASS_GeoTIFF(int first, int last, HashMap<String, ArrayList<Nass_accurcies>> map, ArrayList<Nass_results> cropslist, List<ERU> hrus) throws IllegalArgumentException, IOException { |
|
ArrayList accu_year_list = new ArrayList(); |
Collections.addAll(accu_year_list, CSIP_Const.ACC_years); |
@@ -4,6 +4,7 @@ |
*/ |
package methods; |
|
+import csip.SessionLogger; |
import java.io.BufferedWriter; |
import java.io.File; |
import java.io.FileWriter; |
@@ -48,11 +49,12 @@ |
* @throws IOException |
* @throws URISyntaxException |
*/ |
- public static void NASS_data_check(File outputDir, List<ERU> hrus, HashMap<Integer, ArrayList<Nass_results>> nass_data_result, PrintWriter w_log) throws IOException, URISyntaxException { |
+ public static void NASS_data_check(File outputDir, List<ERU> hrus, HashMap<Integer, ArrayList<Nass_results>> nass_data_result, SessionLogger LOG) throws IOException, URISyntaxException { |
|
//PrintWriter w = new PrintWriter(new FileWriter(new File(outputDir, CSIP_Const.NASS_dominant_result))); |
- w_log.println("===> NASS_dominant_result"); |
- w_log.flush(); |
+ //w_log.println("===> NASS_dominant_result"); |
+ LOG.info("===> NASS_dominant_result"); |
+ //w_log.flush(); |
List<String> records = new ArrayList<>(); |
|
records.add("# All results are based on NASS CropScape dominant crops"); |
@@ -118,7 +120,7 @@ |
* @param dataDir |
* @param hrus |
* @param delta |
- * @param w_log |
+ * @param LOG |
* @throws IOException |
* @throws URISyntaxException |
* @throws SQLException |
@@ -126,7 +128,7 @@ |
* @throws java.lang.InterruptedException |
* @throws java.util.concurrent.ExecutionException |
*/ |
- public static void NASS_data_CropSeq(File dataDir, List<ERU> hrus, double delta, PrintWriter w_log) throws IOException, URISyntaxException, SQLException, ClassNotFoundException, InterruptedException, ExecutionException { |
+ public static void NASS_data_CropSeq(File dataDir, List<ERU> hrus, double delta, SessionLogger LOG) throws IOException, URISyntaxException, SQLException, ClassNotFoundException, InterruptedException, ExecutionException { |
|
Map<String, String> dictonary_map = new HashMap<>(); |
|
@@ -143,9 +145,10 @@ |
conn.close(); |
} |
//Map<String, String> dictonary_map, List<ERU> hrus, double delta, PrintWriter w_log |
- w_log.println(" done nass name acronym."); |
- w_log.flush(); |
- hrus = ConcurrentConfidence(dictonary_map, hrus, delta, w_log); |
+ //w_log.println(" done nass name acronym."); |
+ LOG.info(" done nass name acronym."); |
+ //w_log.flush(); |
+ hrus = ConcurrentConfidence(dictonary_map, hrus, delta, LOG); |
} |
|
/** |
@@ -153,12 +156,11 @@ |
* @param dictonary_map |
* @param hrus |
* @param delta |
- * @param w_log |
* @return |
* @throws InterruptedException |
* @throws ExecutionException |
*/ |
- public static List<ERU> ConcurrentConfidence(Map<String, String> dictonary_map, List<ERU> hrus, double delta, PrintWriter w_log) throws InterruptedException, ExecutionException { |
+ public static List<ERU> ConcurrentConfidence(Map<String, String> dictonary_map, List<ERU> hrus, double delta, SessionLogger LOG) throws InterruptedException, ExecutionException { |
|
int threadnr = 1; |
if (hrus.size() > 30) { |
@@ -174,7 +176,7 @@ |
final List<ERU> fhrus = hrus; |
final Map<String, String> fdictonary_map = dictonary_map; |
final double fdelta = delta; |
- final PrintWriter fPW = w_log; |
+ final SessionLogger fSL = LOG; |
|
final int p = (last + 1) / threadNum; |
int s = (last + 1) - p * threadNum; |
@@ -191,7 +193,7 @@ |
|
@Override |
public List<ERU> call() throws Exception { |
- return CSIP_NASS_LMOD.Confidence(infirst, inlast, fhrus, fdelta, fdictonary_map, ii, fPW); |
+ return CSIP_NASS_LMOD.Confidence(infirst, inlast, fhrus, fdelta, fdictonary_map, ii, fSL); |
} |
}); |
taskList.add(futureTask_1); |
@@ -209,7 +211,7 @@ |
return allHRUs; |
} |
|
- public static List<ERU> Confidence(int first, int last, List<ERU> hrus, double delta, Map<String, String> dictonary_map, int part, PrintWriter w_log) { |
+ public static List<ERU> Confidence(int first, int last, List<ERU> hrus, double delta, Map<String, String> dictonary_map, int part, SessionLogger LOG) { |
|
int count = 0; |
List<ERU> allHRUs = new ArrayList(); |
@@ -225,8 +227,9 @@ |
count = 0; |
double progress = ((double) i - first) / ((double) part_all); |
progress = (double) progress * 100.00; |
- w_log.println(part + ".-" + ((int) progress) + "%..."); |
- w_log.flush(); |
+ //w_log.println(part + ".-" + ((int) progress) + "%..."); |
+ LOG.info(part + ".-" + ((int) progress) + "%..."); |
+ //w_log.flush(); |
} |
//w_log.println(" HRU_ID: " + i); |
//w_log.flush(); |
@@ -470,8 +473,9 @@ |
} |
long end_time = System.currentTimeMillis(); |
double difference = (end_time - start_time) / 1000; |
- w_log.println(" Done first : " + first + " last : " + last + " time : " + difference + " s"); |
- w_log.flush(); |
+ //w_log.println(" Done first : " + first + " last : " + last + " time : " + difference + " s"); |
+ LOG.info(" Done first : " + first + " last : " + last + " time : " + difference + " s"); |
+ //w_log.flush(); |
return allHRUs; |
} |
|
@@ -5,6 +5,7 @@ |
*/ |
package methods; |
|
+import csip.SessionLogger; |
import java.io.BufferedWriter; |
import java.io.File; |
import java.io.FileWriter; |
@@ -47,11 +48,10 @@ |
* @param unique_cmzs |
* @param LMOD_CMZ_Data |
* @param DB_LMOD_map |
- * @param w_log |
* @throws Exception |
*/ |
public static void query_LAMPS_DB_Rotations_For_CMZ(File dataDir, List<String> unique_cmzs, |
- List<ArrayList<String>> LMOD_CMZ_Data, HashMap<String, List<ArrayList<String>>> DB_LMOD_map, PrintWriter w_log) throws Exception { |
+ List<ArrayList<String>> LMOD_CMZ_Data, HashMap<String, List<ArrayList<String>>> DB_LMOD_map, SessionLogger LOG) throws Exception { |
|
unique_cmzs.add("XX"); |
|
@@ -127,8 +127,9 @@ |
count++; |
} |
} |
- w_log.println("Number of Rotations in CMZ " + no_start_zero + " size: " + count); |
- w_log.println(" "); |
+ //w_log.println("Number of Rotations in CMZ " + no_start_zero + " size: " + count); |
+ LOG.info("Number of Rotations in CMZ " + no_start_zero + " size: " + count); |
+ //w_log.println(" "); |
} |
} |
state.close(); |
@@ -210,12 +211,12 @@ |
* @param DB_LMOD_map |
* @param start_year |
* @param end_year |
- * @param w_log |
+ * @param LOG |
* @return |
* @throws InterruptedException |
* @throws ExecutionException |
*/ |
- public static HashMap<Integer, ArrayList<String[]>> ConcurrentMatching(File dataDir, List<ERU> hrus, List<String> CDL_years, List<ArrayList<String>> LMOD_CMZ_Data, HashMap<String, List<ArrayList<String>>> DB_LMOD_map, Integer start_year, Integer end_year, PrintWriter w_log) |
+ public static HashMap<Integer, ArrayList<String[]>> ConcurrentMatching(File dataDir, List<ERU> hrus, List<String> CDL_years, List<ArrayList<String>> LMOD_CMZ_Data, HashMap<String, List<ArrayList<String>>> DB_LMOD_map, Integer start_year, Integer end_year, SessionLogger LOG) |
throws InterruptedException, ExecutionException { |
|
int threadnr = 1; |
@@ -234,7 +235,7 @@ |
final List<ERU> fhrus = hrus; |
final List<ArrayList<String>> fLMOD_CMZ_Data = LMOD_CMZ_Data; |
final HashMap<String, List<ArrayList<String>>> fDB_LMOD_map = DB_LMOD_map; |
- final PrintWriter fPW = w_log; |
+ final SessionLogger fSL = LOG; |
final File fdD = dataDir; |
final int st_year = start_year; |
final int en_year = end_year; |
@@ -253,7 +254,7 @@ |
|
@Override |
public HashMap<Integer, ArrayList<String[]>> call() throws Exception { |
- return CSIP_NASS_LMOD_Matching.Matching(infirst, inlast, fdD, fhrus, fLMOD_CMZ_Data, fDB_LMOD_map, years, st_year, en_year, fPW); |
+ return CSIP_NASS_LMOD_Matching.Matching(infirst, inlast, fdD, fhrus, fLMOD_CMZ_Data, fDB_LMOD_map, years, st_year, en_year, fSL); |
} |
}); |
taskList.add(futureTask_1); |
@@ -292,14 +293,15 @@ |
* @throws ClassNotFoundException |
* @throws SQLException |
*/ |
- public static HashMap<Integer, ArrayList<String[]>> Matching(int first, int last, File dataDir, List<ERU> hrus, List<ArrayList<String>> LMOD_CMZ_Data, HashMap<String, List<ArrayList<String>>> DB_LMOD_map, List<String> years, Integer start_year, Integer end_year, PrintWriter w_log) throws ClassNotFoundException, SQLException { |
+ public static HashMap<Integer, ArrayList<String[]>> Matching(int first, int last, File dataDir, List<ERU> hrus, List<ArrayList<String>> LMOD_CMZ_Data, HashMap<String, List<ArrayList<String>>> DB_LMOD_map, List<String> years, Integer start_year, Integer end_year, SessionLogger LOG) throws ClassNotFoundException, SQLException { |
|
HashMap<Integer, ArrayList<String[]>> map = new HashMap<>(); |
|
JaroWinklerDistance jaro = JaroWinklerDistance.JARO_DISTANCE; |
long start_time = System.currentTimeMillis(); |
- w_log.println(" first : " + first + " last : " + last); |
- w_log.flush(); |
+ //w_log.println(" first : " + first + " last : " + last); |
+ LOG.info(" first : " + first + " last : " + last); |
+ //w_log.flush(); |
|
Class.forName("org.h2.Driver"); |
try (Connection conn = DriverManager.getConnection("jdbc:h2:file:" + dataDir.getPath() + CSIP_Const.LocalDB, "sa", "")) { |
@@ -1062,8 +1064,9 @@ |
} |
} |
if (empty) { |
- w_log.println(" BIIGG ERROR with HRU: " + hrus.get(i).ID + " and sequence: " + hrus.get(i).hru_seq_work); |
- w_log.flush(); |
+ //w_log.println(" BIIGG ERROR with HRU: " + hrus.get(i).ID + " and sequence: " + hrus.get(i).hru_seq_work); |
+ LOG.info(" BIIGG ERROR with HRU: " + hrus.get(i).ID + " and sequence: " + hrus.get(i).hru_seq_work); |
+ //w_log.flush(); |
|
} |
|
@@ -1088,8 +1091,9 @@ |
}//try conn |
long end_time = System.currentTimeMillis(); |
double difference = (end_time - start_time) / 1000; |
- w_log.println(" Done first : " + first + " last : " + last + " time : " + difference + " s"); |
- w_log.flush(); |
+ //w_log.println(" Done first : " + first + " last : " + last + " time : " + difference + " s"); |
+ LOG.info(" Done first : " + first + " last : " + last + " time : " + difference + " s"); |
+ //w_log.flush(); |
return map; |
} |
|
@@ -1102,11 +1106,12 @@ |
* @param w_log |
* @throws IOException |
*/ |
- public static void AOI_NASS_LMOD_generic_match_data_writer(File workspace, List<ERU> hrus, HashMap<Integer, ArrayList<HashMap<Integer, Double>>> irrigation_map, double delta, PrintWriter w_log) throws IOException { |
+ public static void AOI_NASS_LMOD_generic_match_data_writer(File workspace, List<ERU> hrus, HashMap<Integer, ArrayList<HashMap<Integer, Double>>> irrigation_map, double delta, SessionLogger LOG) throws IOException { |
//try (PrintWriter w = new PrintWriter(new FileWriter(new File(workspace, CSIP_Const.AOI_NASS_LMOD_generic_result)))) { |
|
- w_log.println("===> AOI_NASS_LMOD_generic_result"); |
- w_log.flush(); |
+ //w_log.println("===> AOI_NASS_LMOD_generic_result"); |
+ LOG.info("===> AOI_NASS_LMOD_generic_result"); |
+ //w_log.flush(); |
|
List<String> records = new ArrayList<>(); |
|
@@ -1181,15 +1186,15 @@ |
* @param OP_map_tillage |
* @param LMOD_AGES_CID_map |
* @param only_veg_map |
- * @param w_log |
* @throws IOException |
* @throws ClassNotFoundException |
* @throws SQLException |
*/ |
- public static void AOI_NASS_DETECTED_LMODDATA_PREPARATION(File dataDir, List<ERU> hrus, HashMap<String, ArrayList<String[]>> DB_map_managements, ArrayList<String> Unique_LMOD_OPKEYs, ArrayList<String> Unique_LMOD_ManKEYs, HashMap<String, HashMap<Integer, ArrayList<String[]>>> managements, HashMap<String, String> OP_map, HashMap<String, String[]> DB_map_managements_acr, HashMap<String, String[]> OP_map_tillage, HashMap<String, String> LMOD_AGES_CID_map, HashMap<String, String> only_veg_map, PrintWriter w_log) throws IOException, ClassNotFoundException, SQLException { |
+ public static void AOI_NASS_DETECTED_LMODDATA_PREPARATION(File dataDir, List<ERU> hrus, HashMap<String, ArrayList<String[]>> DB_map_managements, ArrayList<String> Unique_LMOD_OPKEYs, ArrayList<String> Unique_LMOD_ManKEYs, HashMap<String, HashMap<Integer, ArrayList<String[]>>> managements, HashMap<String, String> OP_map, HashMap<String, String[]> DB_map_managements_acr, HashMap<String, String[]> OP_map_tillage, HashMap<String, String> LMOD_AGES_CID_map, HashMap<String, String> only_veg_map, SessionLogger LOG) throws IOException, ClassNotFoundException, SQLException { |
|
- w_log.println("===> AOI_NASS_DETECTED_LMODDATA_PREPARATION"); |
- w_log.flush(); |
+ //w_log.println("===> AOI_NASS_DETECTED_LMODDATA_PREPARATION"); |
+ LOG.info("===> AOI_NASS_DETECTED_LMODDATA_PREPARATION"); |
+ //w_log.flush(); |
|
ArrayList<String[]> custom_line = new ArrayList<>(); |
HashMap<Integer, ArrayList<String[]>> man_yearparts_map = new HashMap<>(); |
@@ -1213,8 +1218,9 @@ |
} |
} |
|
- w_log.println("===> PREPARATION: query each HRU-management"); |
- w_log.flush(); |
+ //w_log.println("===> PREPARATION: query each HRU-management"); |
+ LOG.info("===> PREPARATION: query each HRU-management"); |
+ //w_log.flush(); |
|
for (int i = 0; i < hrus.size(); i++) { |
//System.out.println("ID " + hrus.get(i).ID); |
@@ -1273,8 +1279,9 @@ |
} |
} |
|
- w_log.println("===> PREPARATION: query unique OPKeys"); |
- w_log.flush(); |
+ //w_log.println("===> PREPARATION: query unique OPKeys"); |
+ LOG.info("===> PREPARATION: query unique OPKeys"); |
+ //w_log.flush(); |
|
for (String OPKey : Unique_LMOD_OPKEYs) { |
queryString = "select distinct * from \"PUBLIC\".LMOD_OPERATIONS where OPKEY='" + OPKey + "'"; |
@@ -1302,8 +1309,9 @@ |
|
} |
|
- w_log.println("===> PREPARATION: query unique ManKeys"); |
- w_log.flush(); |
+ //w_log.println("===> PREPARATION: query unique ManKeys"); |
+ LOG.info("===> PREPARATION: query unique ManKeys"); |
+ //w_log.flush(); |
|
for (String ManKey : Unique_LMOD_ManKEYs) { |
queryString = "select distinct * from \"PUBLIC\".LMOD_MGMTS_ACR_II where KEY='" + ManKey + "'"; |
@@ -1329,17 +1337,18 @@ |
* @param only_veg_map |
* @param start_year |
* @param end_year |
- * @param w_log |
+ * @param LOG |
* @throws IOException |
* @throws ClassNotFoundException |
* @throws SQLException |
* @throws java.lang.InterruptedException |
* @throws java.util.concurrent.ExecutionException |
*/ |
- public static void AOI_NASS_LMODDATA_costum_generic_writer(File workspace, List<ERU> hrus, HashMap<String, ArrayList<String[]>> DB_map_managements, HashMap<String, HashMap<Integer, ArrayList<String[]>>> managements, HashMap<String, String> OP_map, HashMap<String, String[]> DB_map_managements_acr, HashMap<String, String> LMOD_AGES_MID_map, HashMap<String, String> only_veg_map, Integer start_year, Integer end_year, PrintWriter w_log) throws IOException, ClassNotFoundException, SQLException, InterruptedException, ExecutionException { |
+ public static void AOI_NASS_LMODDATA_costum_generic_writer(File workspace, List<ERU> hrus, HashMap<String, ArrayList<String[]>> DB_map_managements, HashMap<String, HashMap<Integer, ArrayList<String[]>>> managements, HashMap<String, String> OP_map, HashMap<String, String[]> DB_map_managements_acr, HashMap<String, String> LMOD_AGES_MID_map, HashMap<String, String> only_veg_map, Integer start_year, Integer end_year, SessionLogger LOG) throws IOException, ClassNotFoundException, SQLException, InterruptedException, ExecutionException { |
|
- w_log.println("===> AOI_NASS_LMOD_result_custom"); |
- w_log.flush(); |
+ //w_log.println("===> AOI_NASS_LMOD_result_custom"); |
+ LOG.info("===> AOI_NASS_LMOD_result_custom"); |
+ //w_log.flush(); |
|
List<String> records = new ArrayList<>(); |
|
@@ -1358,7 +1367,6 @@ |
final int first = 0; |
final int last = hrus.size() - 1; |
final List<ERU> fhrus = hrus; |
- final PrintWriter fPW = w_log; |
final HashMap<String, ArrayList<String[]>> DB_map_managements_fin = DB_map_managements; |
final HashMap<String, HashMap<Integer, ArrayList<String[]>>> managements_fin = managements; |
final HashMap<String, String> OP_map_fin = OP_map; |
@@ -1382,7 +1390,7 @@ |
|
@Override |
public List<String> call() throws Exception { |
- return CSIP_NASS_LMOD_Matching.AOI_NASS_LMODDATA_costum_generic_concurrent(infirst, inlast, fhrus, DB_map_managements_fin, managements_fin, OP_map_fin, DB_map_managements_acr_fin, LMOD_AGES_MID_map_fin, only_veg_map_fin, start_year_fin, end_year_fin, fPW); |
+ return CSIP_NASS_LMOD_Matching.AOI_NASS_LMODDATA_costum_generic_concurrent(infirst, inlast, fhrus, DB_map_managements_fin, managements_fin, OP_map_fin, DB_map_managements_acr_fin, LMOD_AGES_MID_map_fin, only_veg_map_fin, start_year_fin, end_year_fin); |
} |
}); |
taskList.add(futureTask_1); |
@@ -1411,7 +1419,7 @@ |
|
} |
|
- public static List<String> AOI_NASS_LMODDATA_costum_generic_concurrent(int first, int last, List<ERU> hrus, HashMap<String, ArrayList<String[]>> DB_map_managements, HashMap<String, HashMap<Integer, ArrayList<String[]>>> managements, HashMap<String, String> OP_map, HashMap<String, String[]> DB_map_managements_acr, HashMap<String, String> LMOD_AGES_MID_map, HashMap<String, String> only_veg_map, Integer start_year, Integer end_year, PrintWriter w_log) throws IOException, ClassNotFoundException, SQLException { |
+ public static List<String> AOI_NASS_LMODDATA_costum_generic_concurrent(int first, int last, List<ERU> hrus, HashMap<String, ArrayList<String[]>> DB_map_managements, HashMap<String, HashMap<Integer, ArrayList<String[]>>> managements, HashMap<String, String> OP_map, HashMap<String, String[]> DB_map_managements_acr, HashMap<String, String> LMOD_AGES_MID_map, HashMap<String, String> only_veg_map, Integer start_year, Integer end_year) throws IOException, ClassNotFoundException, SQLException { |
|
List<String> records = new ArrayList<>(); |
|
@@ -10,6 +10,7 @@ |
import com.vividsolutions.jts.geom.MultiPolygon; |
import com.vividsolutions.jts.geom.Polygon; |
import com.vividsolutions.jts.io.WKTReader; |
+import csip.SessionLogger; |
import java.io.BufferedInputStream; |
import java.io.File; |
import java.io.FileInputStream; |
@@ -17,7 +18,6 @@ |
import java.io.IOException; |
import java.io.InputStream; |
import java.io.OutputStream; |
-import java.io.PrintWriter; |
import java.net.URL; |
import java.util.ArrayList; |
import java.util.List; |
@@ -65,11 +65,11 @@ |
* @param unique_states |
* @param unique_cmzs |
* @param envelope |
- * @param w_log |
+ * @param LOG |
* @return |
* @throws Exception |
*/ |
- public static List<ERU> URL_Read_Geometry_File_new(File dataDir, URL hru_url, List<Geometry> Input_Geometries, File outputDir, List<String> unique_states, List<String> unique_cmzs, List<Geometry> envelope, PrintWriter w_log) throws Exception { |
+ public static List<ERU> URL_Read_Geometry_File_new(File dataDir, URL hru_url, List<Geometry> Input_Geometries, File outputDir, List<String> unique_states, List<String> unique_cmzs, List<Geometry> envelope, SessionLogger LOG) throws Exception { |
|
//NASS CropScape max. extend coordinates |
double min_x = 28000000; |
@@ -88,8 +88,9 @@ |
//shape file detection |
if (hru_url.toURI().toString().endsWith(".shp")) { |
|
- w_log.println(" .shp File"); |
- w_log.flush(); |
+ //w_log.println(" .shp File"); |
+ LOG.info(" .shp File"); |
+ //w_log.flush(); |
//target coordinate system in Albers Equal Area projection |
CoordinateReferenceSystem targetCRS = CRS.parseWKT(CSIP_Const.WKT_CooSyst); |
File dir = new File(hru_url.toURI()); |
@@ -170,8 +171,9 @@ |
} |
|
if (hru_url.toURI().toString().endsWith(".kmz")) { |
- w_log.println(" .kmz File"); |
- w_log.flush(); |
+ //w_log.println(" .kmz File"); |
+ LOG.info(" .kmz File"); |
+ //w_log.flush(); |
File ff = new File(outputDir, "kmztokml.kml"); |
OutputStream out = new FileOutputStream(ff); |
//System.out.println(" " + hru_url.getPath()); |
@@ -197,8 +199,9 @@ |
} |
|
if (hru_url.toURI().toString().endsWith(".kml")) { |
- w_log.println(" .kml File"); |
- w_log.flush(); |
+ //w_log.println(" .kml File"); |
+ LOG.info(" .kml File"); |
+ //w_log.flush(); |
|
CRSAuthorityFactory factory = CRS.getAuthorityFactory(true); |
srcCRS = factory.createCoordinateReferenceSystem("EPSG:4326"); |
@@ -314,8 +317,9 @@ |
} |
|
if (hru_url.toURI().toString().endsWith(".geojson")) { |
- w_log.println(" .geojson File"); |
- w_log.flush(); |
+ //w_log.println(" .geojson File"); |
+ LOG.info(" .geojson File"); |
+ //w_log.flush(); |
|
InputStream isn = new FileInputStream(new File(hru_url.toURI())); |
|
@@ -361,7 +365,7 @@ |
} |
|
//calling the georeferencing method to get a states and CMZ linkage for each polygon |
- local_hrus = CSIP_Georeferencing.States_CMZs_intersect_fast(dataDir, env, Input_Geometries, multigeo, w_log); |
+ local_hrus = CSIP_Georeferencing.States_CMZs_intersect_fast(dataDir, env, Input_Geometries, multigeo, LOG); |
|
Geometry extent = JTS.toGeometry(env); |
if (multigeo != null) { |
@@ -388,9 +392,9 @@ |
|
//w_log.println("number of geometies: " + Input_Geometries.size() + " extent checking done. "); |
//w_log.flush(); |
- w_log.println( |
- "number of entities: " + local_hrus.size() + " in: " + unique_cmzs.size() + " CMZ(s) " + unique_cmzs + " (" + unique_states.size() + " State(s) " + unique_states + ")"); |
- w_log.flush(); |
+ //w_log.println("number of entities: " + local_hrus.size() + " in: " + unique_cmzs.size() + " CMZ(s) " + unique_cmzs + " (" + unique_states.size() + " State(s) " + unique_states + ")"); |
+ LOG.info("number of entities: " + local_hrus.size() + " in: " + unique_cmzs.size() + " CMZ(s) " + unique_cmzs + " (" + unique_states.size() + " State(s) " + unique_states + ")"); |
+ //w_log.flush(); |
|
return local_hrus; |
|