Skip to content

Commit

Permalink
SZA
Browse files Browse the repository at this point in the history
  • Loading branch information
Lw46 committed Oct 11, 2022
1 parent 705c7af commit 029de74
Showing 1 changed file with 31 additions and 32 deletions.
63 changes: 31 additions & 32 deletions Download_Input/Angle_save_u2.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 1,
"id": "6b3e41f6-24c1-4e5e-8073-9998a2c6c112",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -1179,55 +1179,54 @@
},
{
"cell_type": "code",
"execution_count": 47,
"execution_count": 5,
"id": "7d69c1ce-866c-403b-9a2a-6ef713feffcd",
"metadata": {},
"outputs": [],
"source": [
"import xarray as xr\n",
"ds = xr.open_rasterio('/data01/GEO/INPUT/ELEVATION/MERIT_DEM_AGRI_05km.tif')"
"import xarray as xr\n"
]
},
{
"cell_type": "code",
"execution_count": 48,
"execution_count": 2,
"id": "5500e9a4-2193-4737-a845-a15512d52168",
"metadata": {},
"outputs": [],
"source": [
"ELEVATION = ds.values \n",
"ELEVATION[ELEVATION<0] = 0\n",
"ELEVATION = np.around(ELEVATION)\n",
"ELEVATION = ELEVATION.astype('u2')\n",
"f_ELEVATION=open('/data01/GEO/INPUT/ELEVATION_GEO/AGRI/MERIT_DEM_AGRI_05km.dat','wb')\n",
"ELEVATION.tofile(f_ELEVATION)\n",
"f_ELEVATION.close()"
"def save_DEM(res,sensor):\n",
" ds = xr.open_rasterio('/data01/GEO/INPUT/ELEVATION/MERIT_DEM_{}_{}km.tif'.format(sensor,res))\n",
" ELEVATION = ds.values \n",
" ELEVATION[ELEVATION<0] = 0\n",
" ELEVATION = np.around(ELEVATION)\n",
" ELEVATION = ELEVATION.astype('u2')\n",
" f_ELEVATION=open('/data01/GEO/INPUT/ELEVATION_GEO/{}/MERIT_DEM_{}_{}km.dat'.format(sensor,sensor,res),'wb')\n",
" ELEVATION.tofile(f_ELEVATION)\n",
" f_ELEVATION.close()"
]
},
{
"cell_type": "code",
"execution_count": 31,
"execution_count": 3,
"id": "e3a4c03d-99bd-4f28-92e3-abab5da9c4d5",
"metadata": {},
"outputs": [],
"source": [
"RES = ['05','1','2']\n",
"SENSOR = ['AHI']"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "79233df8-b269-47f6-a6bf-fe9ec949295b",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([[[148, 147, 145, ..., 84, 84, 84],\n",
" [150, 147, 143, ..., 85, 85, 85],\n",
" [151, 146, 144, ..., 85, 85, 85],\n",
" ...,\n",
" [ 0, 0, 0, ..., 0, 0, 0],\n",
" [ 0, 0, 0, ..., 0, 0, 0],\n",
" [ 0, 0, 0, ..., 0, 0, 0]]], dtype=uint16)"
]
},
"execution_count": 31,
"metadata": {},
"output_type": "execute_result"
}
],
"source": []
"outputs": [],
"source": [
"for i in RES:\n",
" for j in SENSOR:\n",
" save_DEM(i,j)"
]
},
{
"cell_type": "code",
Expand Down

0 comments on commit 029de74

Please sign in to comment.