Skip to content

Instantly share code, notes, and snippets.

View ricardobarroslourenco's full-sized avatar
🇨🇦

Ricardo Barros Lourenço ricardobarroslourenco

🇨🇦
View GitHub Profile
@ricardobarroslourenco
ricardobarroslourenco / 99-Xarray_Cartopy_Reproducible_.ipynb
Last active July 14, 2024 16:23
Xarray-Cartopy RGB channels plot reproducible example
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
(environment_tsrs_v_0_13-cpu) [lourenco@gra796 conda-packs]$ conda list
# packages in environment at /home/lourenco/scratch/conda-packs/environment_tsrs_v_0_13-cpu:
#
# Name Version Build Channel
_libgcc_mutex 0.1 conda_forge conda-forge
_openmp_mutex 4.5 2_kmp_llvm conda-forge
_py-xgboost-mutex 2.0 cpu_0 conda-forge
absl-py 1.4.0 pypi_0 pypi
adagio 0.2.4 pyhd8ed1ab_0 conda-forge
affine 2.4.0 pyhd8ed1ab_0 conda-forge
@ricardobarroslourenco
ricardobarroslourenco / XBboost_Xarray_Dask_error.ipynb
Created July 14, 2023 15:49
Error when running XGBoost + Xarray + Dask
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
We can't make this file beautiful and searchable because it's too large.
TIMESTAMP,TA_F_MDS,TA_F_MDS_QC,TA_F_MDS_NIGHT,TA_F_MDS_NIGHT_SD,TA_F_MDS_NIGHT_QC,TA_F_MDS_DAY,TA_F_MDS_DAY_SD,TA_F_MDS_DAY_QC,TA_ERA,TA_ERA_NIGHT,TA_ERA_NIGHT_SD,TA_ERA_DAY,TA_ERA_DAY_SD,TA_F,TA_F_QC,TA_F_NIGHT,TA_F_NIGHT_SD,TA_F_NIGHT_QC,TA_F_DAY,TA_F_DAY_SD,TA_F_DAY_QC,SW_IN_POT,SW_IN_F_MDS,SW_IN_F_MDS_QC,SW_IN_ERA,SW_IN_F,SW_IN_F_QC,LW_IN_F_MDS,LW_IN_F_MDS_QC,LW_IN_ERA,LW_IN_F,LW_IN_F_QC,LW_IN_JSB,LW_IN_JSB_QC,LW_IN_JSB_ERA,LW_IN_JSB_F,LW_IN_JSB_F_QC,VPD_F_MDS,VPD_F_MDS_QC,VPD_ERA,VPD_F,VPD_F_QC,PA_ERA,PA_F,PA_F_QC,P_ERA,P_F,P_F_QC,WS_ERA,WS_F,WS_F_QC,USTAR,USTAR_QC,NETRAD,NETRAD_QC,PPFD_IN,PPFD_IN_QC,PPFD_DIF,PPFD_DIF_QC,CO2_F_MDS,CO2_F_MDS_QC,TS_F_MDS_1,TS_F_MDS_2,TS_F_MDS_3,TS_F_MDS_4,TS_F_MDS_1_QC,TS_F_MDS_2_QC,TS_F_MDS_3_QC,TS_F_MDS_4_QC,G_F_MDS,G_F_MDS_QC,LE_F_MDS,LE_F_MDS_QC,LE_CORR,LE_CORR_25,LE_CORR_75,LE_RANDUNC,LE_CORR_JOINTUNC,H_F_MDS,H_F_MDS_QC,H_CORR,H_CORR_25,H_CORR_75,H_RANDUNC,H_CORR_JOINTUNC,EBC_CF_N,EBC_CF_METHOD,NIGHT_D,DAY_D,NIGHT_RANDUNC_N,DAY_RANDUNC_N,NEE_CUT_REF,NEE_VUT_REF,NEE_CU
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ricardobarroslourenco
ricardobarroslourenco / office_hours.ipynb
Created March 17, 2023 13:24
Jupyter notebook taken to Xarray Office hours - Mar 17, 2023
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ricardobarroslourenco
ricardobarroslourenco / slow_notebook.ipynb
Created March 15, 2023 18:06
Very slow notebook, especially when writing down the netcdf file
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# extracted from http//www.naturalearthdata.com/download/110m/cultural/ne_110m_admin_0_countries.zip
# under public domain terms
country_bounding_boxes = {
'AF': ('Afghanistan', (60.5284298033, 29.318572496, 75.1580277851, 38.4862816432)),
'AO': ('Angola', (11.6400960629, -17.9306364885, 24.0799052263, -4.43802336998)),
'AL': ('Albania', (19.3044861183, 39.624997667, 21.0200403175, 42.6882473822)),
'AE': ('United Arab Emirates', (51.5795186705, 22.4969475367, 56.3968473651, 26.055464179)),
'AR': ('Argentina', (-73.4154357571, -55.25, -53.628348965, -21.8323104794)),
'AM': ('Armenia', (43.5827458026, 38.7412014837, 46.5057198423, 41.2481285671)),
@ricardobarroslourenco
ricardobarroslourenco / grades_compatibilization.sql
Created April 26, 2018 18:20
Routine for grades conversion
-- Defines a continuous range
UPDATE yulie
SET grades_continuous = cast(grades AS FLOAT)
WHERE grades ~ '^-?[0-9]+\.?[0-9]*$'
UPDATE yulie
SET grades_continuous = (CASE -- Values are the median of ranges
WHEN grades = 'A' OR grades = 'a' THEN 95
WHEN grades = 'B' OR grades = 'b' THEN 85
WHEN grades = 'C' OR grades = 'c' THEN 75