From 566e35d3a5db4962455b3c25f600e39a4eed9f56 Mon Sep 17 00:00:00 2001 From: Samyabrata roy <22f2001443@ds.study.iitm.ac.in> Date: Thu, 24 Apr 2025 23:30:14 +0530 Subject: [PATCH 1/2] Fix: Respect file_dir when saving .grd files --- .DS_Store | Bin 0 -> 6148 bytes imdlib/core.py | 2 +- imdlib/run_download.py | 4 ++++ 3 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 .DS_Store create mode 100644 imdlib/run_download.py diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..8d38f5f79cffc29f9accd9fbd7a1e211c2ca584f GIT binary patch literal 6148 zcmeHKL2uJA82#L3Ysv)l0D=orB(78FkU*QbbX|Lx#5gPn4uDFs239SLOOsNjs#34O zf8Z~0Oqed$IlE*f9}_&SbDj)FdJoiP5=)?402HoR*?y zYOVli^V{PZ=E*zJ6AJuBaWTB{W%?CvH`EYc!-2a1&ru;ePxbH=1T6v-*6AM#(VCTdl96 zw&JX=)!n+g?!E|)5DxWyE0W>Dw!t~w^c6Qrnj!Q?(pFl~LL(@J~nS&{F68$)xRS4AFV z7d^}*bk{HXKy3f51J;2*?f|b39ui~Q;6kHXI*_R&0MJ3T3Y2;4XN_mDZE&FxcMw8L zfm$le5kqJ>>OI428(e7AauVk7Axz7{oKS>n9nbd^okUxs&8-90fwBWD`m)LUfA81l z|FXzlSqH2G|CIy6=?2{nhGh2ErNQxD>mj{F;$YrFqmm#q+p#L}R(uml1@3uV0JaS- TG@=G!e*}~bHnR@=RR?|moObHV literal 0 HcmV?d00001 diff --git a/imdlib/core.py b/imdlib/core.py index 3652fc9..ea644e6 100644 --- a/imdlib/core.py +++ b/imdlib/core.py @@ -846,7 +846,7 @@ def get_data(var_type, start_yr, end_yr=None, fn_format=None, file_dir=None, sub fname = os.path.join( file_dir, var_type) + '/' + fini + str(year) + fend else: - fname = fini + str(year) + fend + fname = os.path.join(file_dir, fini + str(year) + fend) # here I have fixed the bug else: if fn_format == 'yearwise': fname = var_type + '/' + str(year) + fend diff --git a/imdlib/run_download.py b/imdlib/run_download.py new file mode 100644 index 0000000..e6a2aa8 --- /dev/null +++ b/imdlib/run_download.py @@ -0,0 +1,4 @@ +from core import get_data + +data = get_data("tmin", 2000, 2003, fn_format='yearwise', file_dir="data") +print("Download done.") \ No newline at end of file From 4045e78da06881fd4775990c931c73991fed85a5 Mon Sep 17 00:00:00 2001 From: Samyabrata roy Date: Fri, 25 Apr 2025 00:24:14 +0530 Subject: [PATCH 2/2] Fix: Respect file_dir when saving .grd files --- .DS_Store | Bin 0 -> 6148 bytes imdlib/core.py | 2 +- imdlib/run_download.py | 4 ++++ 3 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 .DS_Store create mode 100644 imdlib/run_download.py diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..8d38f5f79cffc29f9accd9fbd7a1e211c2ca584f GIT binary patch literal 6148 zcmeHKL2uJA82#L3Ysv)l0D=orB(78FkU*QbbX|Lx#5gPn4uDFs239SLOOsNjs#34O zf8Z~0Oqed$IlE*f9}_&SbDj)FdJoiP5=)?402HoR*?y zYOVli^V{PZ=E*zJ6AJuBaWTB{W%?CvH`EYc!-2a1&ru;ePxbH=1T6v-*6AM#(VCTdl96 zw&JX=)!n+g?!E|)5DxWyE0W>Dw!t~w^c6Qrnj!Q?(pFl~LL(@J~nS&{F68$)xRS4AFV z7d^}*bk{HXKy3f51J;2*?f|b39ui~Q;6kHXI*_R&0MJ3T3Y2;4XN_mDZE&FxcMw8L zfm$le5kqJ>>OI428(e7AauVk7Axz7{oKS>n9nbd^okUxs&8-90fwBWD`m)LUfA81l z|FXzlSqH2G|CIy6=?2{nhGh2ErNQxD>mj{F;$YrFqmm#q+p#L}R(uml1@3uV0JaS- TG@=G!e*}~bHnR@=RR?|moObHV literal 0 HcmV?d00001 diff --git a/imdlib/core.py b/imdlib/core.py index 3652fc9..ea644e6 100644 --- a/imdlib/core.py +++ b/imdlib/core.py @@ -846,7 +846,7 @@ def get_data(var_type, start_yr, end_yr=None, fn_format=None, file_dir=None, sub fname = os.path.join( file_dir, var_type) + '/' + fini + str(year) + fend else: - fname = fini + str(year) + fend + fname = os.path.join(file_dir, fini + str(year) + fend) # here I have fixed the bug else: if fn_format == 'yearwise': fname = var_type + '/' + str(year) + fend diff --git a/imdlib/run_download.py b/imdlib/run_download.py new file mode 100644 index 0000000..e6a2aa8 --- /dev/null +++ b/imdlib/run_download.py @@ -0,0 +1,4 @@ +from core import get_data + +data = get_data("tmin", 2000, 2003, fn_format='yearwise', file_dir="data") +print("Download done.") \ No newline at end of file