Skip to content

Commit

Permalink
Merge pull request #3 from CIAT-DAPA/develop
Browse files Browse the repository at this point in the history
removed te error
  • Loading branch information
santiago123x authored Jun 19, 2024
2 parents e719002 + 3c39341 commit ede3620
Show file tree
Hide file tree
Showing 19 changed files with 15 additions and 138 deletions.
Binary file removed shp/limite_nacional_2011/limite_nacional.rar
Binary file not shown.
Binary file removed shp/limite_nacional_2011/limite_nacional_2011.dbf
Binary file not shown.
1 change: 0 additions & 1 deletion shp/limite_nacional_2011/limite_nacional_2011.prj

This file was deleted.

Binary file removed shp/limite_nacional_2011/limite_nacional_2011.sbn
Binary file not shown.
Binary file removed shp/limite_nacional_2011/limite_nacional_2011.sbx
Binary file not shown.
Binary file removed shp/limite_nacional_2011/limite_nacional_2011.shp
Binary file not shown.
2 changes: 0 additions & 2 deletions shp/limite_nacional_2011/limite_nacional_2011.shp.xml

This file was deleted.

Binary file removed shp/limite_nacional_2011/limite_nacional_2011.shx
Binary file not shown.
Binary file not shown.
1 change: 0 additions & 1 deletion shp/limites_municipales_2001/limite_municipal_2001.prj

This file was deleted.

Binary file not shown.
Binary file removed shp/limites_municipales_2001/limite_municipal_2001.sbx
Binary file not shown.
Binary file not shown.
Empty file.
117 changes: 0 additions & 117 deletions shp/limites_municipales_2001/limite_municipal_2001.shp.xml

This file was deleted.

Binary file not shown.
Binary file not shown.
6 changes: 2 additions & 4 deletions src/postprocessing/export_average.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@
from datetime import datetime, timedelta


def export_raster(dataset, file_name, specific_variable, output_path, is4Dim=False):
def export_raster(dataset, file_name, specific_variable, output_path, shp_path, is4Dim=False):

# Get the current script directory
current_path = os.path.dirname(os.path.abspath(__file__))
output_path_folder = os.path.join(output_path, file_name)
parent_dir = os.path.dirname(os.path.dirname(current_path))
shp_path = os.path.join(parent_dir, 'shp', "limite_nacional_2011", "limite_nacional_2011.shp")
shp_path = os.path.join(shp_path, "limite_nacional_2011", "limite_nacional_2011.shp")

if not os.path.exists(output_path):
os.makedirs(output_path)
Expand Down
26 changes: 13 additions & 13 deletions src/postprocessing/extract_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@

def extract_data(inputs_path, outputs_path):

shp_path = os.path.join(inputs_path, "shapefile")
inputs_path = os.path.join(inputs_path, "wrf")

# Filtrar solo los archivos
nc_files = [os.path.join(inputs_path, file) for file in os.listdir(inputs_path) if file.endswith('.nc')]
nc_files = [os.path.join(inputs_path, file) for file in os.listdir(inputs_path)]

for file in nc_files:

Expand All @@ -19,23 +22,23 @@ def extract_data(inputs_path, outputs_path):

dataset = nc.Dataset(file)

T2 = export_raster(dataset, file_name, "T2", outputs_path)
T2 = export_raster(dataset, file_name, "T2", outputs_path, shp_path)

RAINNC = export_raster(dataset, file_name, "RAINNC", outputs_path)
RAINNC = export_raster(dataset, file_name, "RAINNC", outputs_path, shp_path)

HGT = export_raster(dataset, file_name, "HGT", outputs_path)
HGT = export_raster(dataset, file_name, "HGT", outputs_path, shp_path)

SWDOWN = export_raster(dataset, file_name, "SWDOWN", outputs_path)
SWDOWN = export_raster(dataset, file_name, "SWDOWN", outputs_path, shp_path)

U10 = export_raster(dataset, file_name, "U10", outputs_path)
U10 = export_raster(dataset, file_name, "U10", outputs_path, shp_path)

V10 = export_raster(dataset, file_name, "V10", outputs_path)
V10 = export_raster(dataset, file_name, "V10", outputs_path, shp_path)

P = export_raster(dataset, file_name, "P", outputs_path, True)
P = export_raster(dataset, file_name, "P", outputs_path, shp_path, True)

PB = export_raster(dataset, file_name, "PB", outputs_path, True)
PB = export_raster(dataset, file_name, "PB", outputs_path, shp_path, True)

QVAPOR = export_raster(dataset, file_name, "QVAPOR", outputs_path, True)
QVAPOR = export_raster(dataset, file_name, "QVAPOR", outputs_path, shp_path, True)

WS10m = calcWS10m(U10, V10)

Expand Down Expand Up @@ -192,6 +195,3 @@ def calcRH(T2, P, PB, Q):
print(f"Raster {file_name} created successfully")

return T2.replace("T2","RH")


extract_data("D:\\Code\\Honduras\\Docker\\postprocessing\\files")

0 comments on commit ede3620

Please sign in to comment.